/* Nav Menu JS */
	ylo_sfHover = function() {
		var sfEls = document.getElementById("ylo_nav_menu").getElementsByTagName("LI");
		for (var i=0; i<sfEls.length; i++) {
			sfEls[i].onmouseover=function() {
				this.className+=" ylo_sfhover";
			}
			sfEls[i].onmouseout=function() {
				this.className=this.className.replace(new RegExp(" ylo_sfhover\\b"), "");
			}
		}
	}
	if (window.attachEvent) window.attachEvent("onload", ylo_sfHover);
/* End Nav Menu JS */


var bustcachevar=1; //bust potential caching of external pages after initial request? (1=yes, 0=no)
var loadedobjects="";
var rootdomain="http://"+window.location.hostname;
var bustcacheparameter="";
function ylo_search(v) {
	search_div = document.getElementById('ylo_top_search_results');
	search_div.style.display = "block";
	//content = "<ul><li><a href=''>Brandon Carlson</a></li><li><a href=''>Brandon Carlson</a></li><li><a href=''>Brandon Carlson</a></li></ul>";
	if(v.length>=3) {
		new_v = encodeURIComponent(v);
		url ="/yourlistonline.com/newsite/user/ajax_search/"+new_v;
		ylo_ajax_request(url,'ylo_top_search_results',0);
	}
	else {
		search_div.style.display = "none";
	}
	//search_div.innerHTML = content;
}
function ylo_loadpage(page_request, containerid,append_to){
	if (page_request.readyState == 4 && (page_request.status==200 || window.location.href.indexOf("http")==-1)) {
		if(append_to==0) {
			document.getElementById(containerid).innerHTML=page_request.responseText;
		}
		else {
			document.getElementById(containerid).innerHTML+=page_request.responseText;
		}
	}
}
function ylo_ajax_request(url, containerid,append_to){
	var page_request = false
	if (window.XMLHttpRequest) { // if Mozilla, Safari etc
		page_request = new XMLHttpRequest();
	}
	else if (window.ActiveXObject){ // if IE
		try {
			page_request = new ActiveXObject("Msxml2.XMLHTTP");
		} 
		catch (e){
		try{
			page_request = new ActiveXObject("Microsoft.XMLHTTP");
		}
		catch (e){}
		}
	}
	else {
		return false
	}
	page_request.onreadystatechange=function(){
		ylo_loadpage(page_request, containerid,append_to);
	}
	if (bustcachevar) {//if bust caching of external page
		bustcacheparameter=(url.indexOf("?")!=-1)? "&"+new Date().getTime() : "?"+new Date().getTime()
	}
	page_request.open('GET', url+bustcacheparameter, true);
	page_request.send(null);
}
function checkListAccessOption(obj) {
	var option_selected = obj.options[obj.selectedIndex].value;
	if(option_selected==3) {
		toggleDiv('ylo_list_groups','on');
		toggleDiv('ylo_invite_box','on');
	}
	if(option_selected==2) {
		toggleDiv('ylo_list_groups','off');
		toggleDiv('ylo_invite_box','off');
	}
	if(option_selected==1) {
		toggleDiv('ylo_invite_box','on');
		toggleDiv('ylo_list_groups','off');
	}
}
function toggleDiv(id,action) {
	if(action!="") {
		if(action=="on") {
			display_option = "block";
		}
		else {
			display_option = "none";
		}
		document.getElementById(id).style.display = display_option;
	}
	else {
		if(document.getElementById(id).style.display=="none" || document.getElementById(id).style.display=="") {
			document.getElementById(id).style.display = "block";
		}
		else {
			document.getElementById(id).style.display = "none";
		}
	}
}
var invite_counter = 1;
function add_another_invite_line() {
	invite_counter++;
	new_line = "counter: "+invite_counter+"<br />";
	new_line = "<strong>Invite "+invite_counter+"</strong>";
	new_line += "<div class='ylo_form_line'>";
	new_line += "<label>First</label><input type='text' name='data[Invite]["+invite_counter+"][first_name]' /></div>";
	new_line += "<div class='ylo_form_line'>";
	new_line += "<label>Last</label><input type='text' name='data[Invite]["+invite_counter+"][last_name]' /></div>";
	new_line += "<div class='ylo_form_line'>";
	new_line += "<label>Email</label><input type='text' name='data[Invite]["+invite_counter+"][email]' />";
	new_line += "</div>";
	var invite_div = document.createElement('div');
	invite_div.innerHTML = new_line;
	document.getElementById('ylo_invite_box_entry').appendChild(invite_div);
	//document.getElementById('ylo_invite_box_entry').innerHTML += new_line;

}
