
var isIE = (window.ActiveXObject);	

var browser=navigator.appName;
var k=browser.indexOf('Opera');
var isOpera=0;
if (k!=-1) {isOpera=1;}

var search1=1;
var search2=0;

//----------------------------------
function ds (divname,k) {
	divobj=document.getElementById(divname).style;
	if (k==0) {
		divobj.display='block';
		k=1;
	} else {
		divobj.display='none';
		k=0;
	}
	return k;
}
//----------------------------------
function hs (divname) {
	divobj=document.getElementById(divname).style;
	if (divobj.visibility!='visible') {
		divobj.visibility='visible';
	} else {
		divobj.visibility='hidden';
	}
	return false;
}
//------------------------------------------------
function hss (txt,wh) {
	document.getElementById('where_st').innerHTML=txt; 
	document.search_form.where.value=wh;  
	hs('search_popup_div');
	return false;
}
//------------------------------------------------
function show_img(URL) {
	document.getElementById("usr_img").innerHTML="<img src=\""+URL+"\" class=img />";
	return false;
}
//----------------------------------
function dochatlogout() {
		xmlHttp=GetXmlHttpObject();
		if (xmlHttp==null) {
  			alert ("Your browser does not support AJAX!");
  			return;
  		} 
  		var content="";
		xmlHttp.open("POST","/chat/?logout=true",true);
		xmlHttp.setRequestHeader ('Content-Type',   'application/x-www-form-urlencoded');
		xmlHttp.send (content);
}
//----------------------------------
function openWindow(url,width,height,options,name) {
                width = width ? width : 800;
                height = height ? height : 600;
                options = options ? options : 'resizable=yes';
                name = name ? name : 'openWindow';
                window.open(
                    url,
                    name,
                    'screenX='+(screen.width-width)/2+',screenY='+(screen.height-height)/2+',width='+width+',height='+height+','+options
                )
            }
//----------------------------------
function reset_form(oo,n) {
								oo.me_sex.selectedIndex=0;
								oo.want_sex.selectedIndex=0;
								oo.age1.value='';
								oo.age2.value='';
								oo.with_image.checked=0;
							if (n==2) {
								oo.country.selectedIndex=0;
								//getElementById("sgeorgia_city_div").innerHTML="";
								//getElementById("sgeorgia_city_div_other").innerHTML="";
								oo.city.selectedIndex=0;
								oo.city_other.value='';
								oo.build.selectedIndex=0;
								oo.hair.selectedIndex=0;
								oo.eye.selectedIndex=0;
							
								
								for (var i=0; i<oo["purpose[]"].length; i++) {
									oo["purpose[]"][i].checked=0;
								}
							}	
								//return false;
}
//----------------------------------
//----------------------------------
function stateChanged_move_images() { 
	if (xmlHttp.readyState==4){ 	
		insert_data_into_images_div(base_url,un);
	}
}
//----------------------------------
function moveCells(direction,id,un) { 
  var content="?action=change_details&id="+id+"&ac=move_"+direction;
 xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null) {
  			alert ("Your browser does not support AJAX!");
  			return;
  	} 
  	xmlHttp.onreadystatechange=stateChanged_move_images;
	xmlHttp.open("GET",content+"&un="+un+"&sid="+Math.random(),true);
	xmlHttp.setRequestHeader ('Content-Type',   'application/x-www-form-urlencoded');
	xmlHttp.send (content);
	return false;
} 
//----------------------------------
function deleteRow (r,tablename,id,base_url,un) {
	var i=r.parentNode.parentNode.rowIndex;
	document.getElementById(tablename).deleteRow(i);
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null) {
  			alert ("Your browser does not support AJAX!");
  			return;
  	} 
	var content="";
	xmlHttp.open("GET","?action=change_details&id="+id+"&un="+un+"&ac=delete_image&sid="+Math.random(),true);
	xmlHttp.setRequestHeader ('Content-Type',   'application/x-www-form-urlencoded');
	xmlHttp.send (content);
	return false;
}
//----------------------------------
function stateChanged_images() { 
	if (xmlHttp.readyState==4){ 	
		document.getElementById("images_div").innerHTML=xmlHttp.responseText;
	}
}
//----------------------------------
function insert_data_into_images_div(base_url,un) {
	document.getElementById("images_div").innerHTML="<br>&nbsp;<br><img src="+base_url+"i/loading.gif";
		xmlHttp=GetXmlHttpObject();
		if (xmlHttp==null) {
  			alert ("Your browser does not support AJAX!");
  			return;
  		} 
  		var content="sid="+Math.random();
		xmlHttp.onreadystatechange=stateChanged_images;
		xmlHttp.open("POST",base_url+"scripts/get_user_images.php?un="+un,true);
		xmlHttp.setRequestHeader ('Content-Type',   'application/x-www-form-urlencoded');
		xmlHttp.send (content);
}
//----------------------------------
function GetXmlHttpObject()
{
var xmlHttp=null;
try  {
  // Firefox, Opera 8.0+, Safari
  xmlHttp=new XMLHttpRequest();
 }
catch (e)  {
  // Internet Explorer
  try    {
    xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
  }
  catch (e)    {
    xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
}
return xmlHttp;
}
//----------------------------------