var global_disp_image_width  =0;  // use in profile view
var global_disp_image_height =0;  // use in profile view
var global_disp_image_prefix =''; // use in profile view
var global_roll_image_clicked = 0; // use in profile view
var global_validateJoinForm = true;						
var oldImageIndex=0;
      
function checkStandard()
			{
				//alert("what is there");
				selectMembership = document.getElementById("MembershipID");
				if(selectMembership.value == 2)
				{
					//alert("i am standard");
					document.getElementById("MembershipDays").disabled = true;
					document.getElementById("MembershipImmediately").disabled = true;
				}
				else if(selectMembership.value == 3)
				{
					//alert("i am promotion");
					document.getElementById("MembershipDays").disabled = false;
					document.getElementById("MembershipImmediately").disabled = false;
				}
			}
			
function setCheckboxes(the_form, do_check)
{

	var elts  = document.forms[the_form].getElementsByTagName('input');
    var elts_cnt  = elts.length;
    var i = 0;

    for ( i; i < elts_cnt; i++)
    {
    
    //alert(elts[i].name);
        elts[i].checked = do_check;
		if (the_form + "_submit" == elts[i].name)
		{
			elts[i].disabled = !do_check;
		}
    } // end for
	return true;
} // end of the 'setCheckboxes()' function

function setButtons(the_form, do_check)
{
	var elts  = document.forms[the_form].getElementsByTagName('input');
    var elts_cnt  = elts.length;
    var i = 0;

    for ( i; i < elts_cnt; i++)
    {
        //elts[i].checked = do_check;
		if (the_form + "_submit" == elts[i].name)
		{
			elts[i].disabled = !do_check;
		}
    } // end for
	return true;
} // end of the 'setButtons()' function

function setCheckbox(the_form)
{
    var elts      = document.forms[the_form].getElementsByTagName('input');
    var elts_cnt  = elts.length;

    var allUnchecked = true;

    for (var i = 0; i < elts_cnt; i++)
    {
        if(elts[i].checked) allUnchecked = false;
    }

    for (var i = 0; i < elts_cnt; i++)
    {
        if(elts[i].name == (the_form + "_submit")) elts[i].disabled = allUnchecked;
    }

    return true;
}


var win = "width=500,height=600,left=100,top=100,copyhistory=no,directories=no,menubar=no,location=no,resizable=no,scrollbars=yes";
function get_gallery(id_prof)
{
   window.open("photos_gallery.php?ID="+id_prof,'gallery',win);
}

function launchTellFriend ()
{
    var win = "width=300,height=300,left=200,top=100,copyhistory=no,directories=no,menubar=no,location=no,resizable=no,scrollbars=no";
    window.open("tellfriend.php",'tellfriend',win);
    return false;
}

function launchTellFriendProfile ( sID )
{
    var win = "width=340,height=300,left=200,top=100,copyhistory=no,directories=no,menubar=no,location=no,resizable=no,scrollbars=no";
    window.open("tellfriend.php?ID="+sID,'tellfriendprofile',win);
    return false;
}

function BxShowBlock( id )
{

	var el;
	el = document.getElementById( id );

	if( el.style.display == 'none' )
	{
		el.style.display = 'block'
	}
	else
	{
		el.style.display = 'none'
	}

	return false;
}

function ShowShowHide ( show_name, show_name2, hide_name )
{
    if (hide_name) hide_name.style.display = 'none';
    if (show_name) show_name.style.display = 'inline';
    if (show_name2) show_name2.style.display = 'inline';
}

function ShowHideHide ( show_name, hide_name, hide_name2 )
{
    if (hide_name) hide_name.style.display = 'none';
    if (hide_name2) hide_name2.style.display = 'none';
    if (show_name) show_name.style.display = 'inline';
}

function charCounter(field,maxLength,countTarget)
{

	field = document.getElementById(field);
	countTarget = document.getElementById(countTarget);
	var inputLength=field.value.length;

	if(inputLength >= maxLength)
	{
		field.value=field.value.substring(0,maxLength);

	}
	countTarget.innerHTML=maxLength-field.value.length;


}



/**
 * change images onHover mouse action
 */
function show(FileName,jpg1Name)
{
	document.images[FileName].src = jpg1Name;
}

/**
 * set status of the browser window to 's'
 */
function ss(s)
{
	window.status = s;
	return true;
}

/**
 * set status of the browser window to empty
 */
function ce()
{
	window.status='';
}


/*
 * insert emotion item
 */
function emoticon( txtarea, text ) {

	text = ' ' + text + ' ';
	if (txtarea.createTextRange && txtarea.caretPos) {
		var caretPos = txtarea.caretPos;
		caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == ' ' ? text + ' ' : text;
		txtarea.focus();
	} else {
		txtarea.value  += text;
		txtarea.focus();
	}
}

function launchAddToIM (id)
{
    var win = "width=600,height=160,left=100,top=100,copyhistory=no,directories=no,menubar=no,location=no,resizable=no,scrollbars=yes";
    window.open("explanation.php?explain=imadd&ID="+id,'add_to_im',win);
    return false;
}

function docOpen(text)
{
	newWindow=window.open('','','toolbar=no,resizable=yes,scrollbars=yes,width=400,height=300');
	newWindow.document.open("text/html");
	newWindow.document.write(unescape(text));
	newWindow.document.close();
}

function get_data( container, url, siteUrl )
    {

        if ( container )
        {
	    var container = document.getElementById( container );
	    container.innerHTML = "loading ... ";
        }

        var XMLHttpRequestObject = false;

        if ( window.XMLHttpRequest )
        {
                XMLHttpRequestObject = new XMLHttpRequest();
        }
        else if ( window.ActiveXObject )
        {
                XMLHttpRequestObject = new ActiveXObject("Microsoft.XMLHTTP");
        }


	if( XMLHttpRequestObject )
        {
    	    var data_source = siteUrl + 'xml/menu.php' + url + '&_t=' + Math.random();
    	    XMLHttpRequestObject.open( "GET", data_source );
    	    XMLHttpRequestObject.onreadystatechange = function()
    	    {
        	if ( XMLHttpRequestObject.readyState == 4 && XMLHttpRequestObject.status == 200 )
        	{

        	var xmlDocument = XMLHttpRequestObject.responseXML;
            delete XMLHttpRequestObject;
            XMLHttpRequestObject = null;

		   	names = xmlDocument.getElementsByTagName("name");
		    links = xmlDocument.getElementsByTagName("link");

		    list_sublinks(names, links);

        	}
    	    }

            XMLHttpRequestObject.send( null );

	}

	//container.innerHTML = '';




	function list_sublinks(names, links)
	{
    	var loopIndex, name, link, maxIndex = names.length;

	    container.innerHTML = '';
	    for ( loopIndex = 0; loopIndex < maxIndex; loopIndex++ )
   	    {

		    //if ( values[loopIndex].firstChild.nodeName=="name")
			name = names[loopIndex].firstChild.nodeValue;

		    //if ( values[loopIndex].childNodes[1].nodeName=="link")
			link = links[loopIndex].firstChild.nodeValue;

		    container.innerHTML += '<div class="innerSubmenuDiv"><a href="' + link + '">' + name + '</a></div>';
	    }

	}
}


function createNamedElement( type, name )
{

    var element;

    try
    {
        element = document.createElement('<'+type+' name="'+name+'">');
    } catch (e) { }

    if (!element || !element.name) // Cool, this is not IE !!
    {
        element = document.createElement(type)
        element.name = name;
    }

    return element;
}

function display_node(node, siteUrl)
{

    var nn = document.getElementById( node );

	var sub_name = node.split('_')[1];
    if ( 'none' == nn.style.display )
    {
	nn.style.display='block';
	if ( '' == nn.innerHTML )
	    get_data( node, '?action=menu&ID=' + sub_name, siteUrl);
    }
    else
    {
		nn.style.display='none';
    }

}

function stripSlashes(str)
{
	return str.replace(/\\/g, '');
}


// WORLDCITIES INSTALL

// declare a global  XMLHTTP Request object
var geo_XmlHttpObj;
var geo_fl_country;
var geo_fl_region;
var geo_fl_city;
var geo_fl_prefix;

// create an instance of XMLHTTPRequest Object, varies with browser type, try for IE first then Mozilla
function geo_CreateXmlHttpObj()
{
	// try creating for IE (note: we don't know the user's browser type here, just attempting IE first.)
	try
	{
		geo_XmlHttpObj = new ActiveXObject("Msxml2.XMLHTTP");
	}
	catch(e)
	{
		try
		{
			geo_XmlHttpObj = new ActiveXObject("Microsoft.XMLHTTP");
		} 
	catch(oc)
		{
			geo_XmlHttpObj = null;
		}
	}
	// if unable to create using IE specific code then try creating for Mozilla (FireFox) 
	if(!geo_XmlHttpObj && typeof XMLHttpRequest != "undefined") 
	{
		geo_XmlHttpObj = new XMLHttpRequest();
	}
}

// called from onChange or onClick event of the continent dropdown list
function CountryListOnChange(pfl_country,pfl_region,pfl_city,pfl_prefix) 
{
    // update public variable
    geo_fl_country = pfl_country;
    geo_fl_region  = pfl_region;
    geo_fl_city    = pfl_city;
    geo_fl_prefix  = pfl_prefix
    
    window.status = "Loading Region .....";	

    var Geo_Country = document.getElementById(geo_fl_country).value;

    var requestUrl;
    var s = current_date_txt();
    requestUrl = site_url + "modmysite/worldcities/geo_data_provider.php" + "?action=r&country=" + encodeURIComponent(Geo_Country) + '&date=' + s + '&prefix=' + geo_fl_prefix;
  	geo_CreateXmlHttpObj();
	 
	  if(geo_XmlHttpObj)
	    { 
		  geo_XmlHttpObj.onreadystatechange = RegionStateChangeHandler;
		  geo_XmlHttpObj.open("GET", requestUrl,  true);
		  geo_XmlHttpObj.send(null);		
	    }
}

//called from onChange or onClick event of the continent dropdown list
function CountryListOnChangelp(pfl_country,pfl_region,pfl_city,pfl_prefix,geopoint,geodistance) 
{
    // update public variable
    geo_fl_country = pfl_country;
    geo_fl_region  = pfl_region;
    geo_fl_city    = pfl_city;
    geo_fl_prefix  = pfl_prefix
    
    
    window.status = "Loading Region .....";	

    var Geo_Country = document.getElementById(geo_fl_country).value;

    var requestUrl;
    var s = current_date_txt();
    requestUrl = site_url + basedir + "/scripts/index/geo_data_provider.php" + "?action=r&country=" + encodeURIComponent(Geo_Country) + "&geopoint=" + geopoint + "&geodistance=" + geodistance + '&date=' + s + '&prefix=' + geo_fl_prefix;
    
  	geo_CreateXmlHttpObj();
	 
	  if(geo_XmlHttpObj)
	    { 
		  geo_XmlHttpObj.onreadystatechange = RegionStateChangeHandler;
		  geo_XmlHttpObj.open("GET", requestUrl,  true);
		  geo_XmlHttpObj.send(null);		
	    }
}

//called from onChange or onClick event of the continent dropdown list
function CountryListNotmultiOnChange(pfl_country,pfl_region,pfl_city,pfl_prefix) 
{
    // update public variable
    geo_fl_country = pfl_country;
    geo_fl_region  = pfl_region;
    geo_fl_city    = pfl_city;
    geo_fl_prefix  = pfl_prefix
    
    
    window.status = "Loading Region .....";	

    var Geo_Country = document.getElementById(geo_fl_country).value;

    var requestUrl;
    var s = current_date_txt();
    requestUrl = site_url + "modmysite/worldcities/geo_data_provider.php" + "?action=r&country=" + encodeURIComponent(Geo_Country) + '&date=' + s + '&prefix=' + geo_fl_prefix+'&notmulti=1';
    
  	geo_CreateXmlHttpObj();
	 
	  if(geo_XmlHttpObj)
	    { 
		  geo_XmlHttpObj.onreadystatechange = RegionStateChangeHandler;
		  geo_XmlHttpObj.open("GET", requestUrl,  true);
		  geo_XmlHttpObj.send(null);		
	    }
}


function RegionStateChangeHandler()
{ 
 if (  geo_XmlHttpObj.readyState == 4  )
    {
		if( geo_XmlHttpObj.status == 200 )
		{	
      document.getElementById('div_' + geo_fl_region).innerHTML =  geo_XmlHttpObj.responseText;
      RegionListOnChange(geo_fl_country,geo_fl_region,geo_fl_city,geo_fl_prefix);
      window.status = ""; 								
		}
  }					
}


// called from onChange or onClick event of the continent dropdown list
function RegionListOnChange(pfl_country,pfl_region,pfl_city,pfl_prefix) 
{
    // update public variable
    geo_fl_country = pfl_country;
    geo_fl_region  = pfl_region;
    geo_fl_city    = pfl_city;
    geo_fl_prefix  = pfl_prefix
    
    window.status = "Loading City .....";	
    var Geo_Region = document.getElementById(geo_fl_region).value;
    var Geo_Country = document.getElementById(geo_fl_country).value;

    var requestUrl;
    var s = current_date_txt();
    requestUrl = site_url + "modmysite/worldcities/geo_data_provider.php" + "?action=c&region=" + encodeURIComponent(Geo_Region) + "&country=" + encodeURIComponent(Geo_Country)  + "&date=" + s + '&prefix=' + geo_fl_prefix;
    
  	geo_CreateXmlHttpObj();
	 
	  if(geo_XmlHttpObj)
	    { 
		  geo_XmlHttpObj.onreadystatechange = CityStateChangeHandler;
		  geo_XmlHttpObj.open("GET", requestUrl,  true);
		  geo_XmlHttpObj.send(null);		
	    }
}


function RegionListOnChangelp(pfl_country,pfl_region,pfl_city,pfl_prefix,geopoint,geodistance) 
{
	
    // update public variable
    geo_fl_country = pfl_country;
    geo_fl_region  = pfl_region;
    geo_fl_city    = pfl_city;
    geo_fl_prefix  = pfl_prefix
    
    window.status = "Loading City .....";	
    var Geo_Region = document.getElementById(geo_fl_region).value;
    var Geo_Country = document.getElementById(geo_fl_country).value;
    var requestUrl;
    var s = current_date_txt();
    requestUrl = site_url + basedir + "/scripts/index/geo_data_provider.php" + "?action=c&region=" + encodeURIComponent(Geo_Region) + "&country=" + encodeURIComponent(Geo_Country)  + "&geopoint=" + geopoint + "&geodistance=" + geodistance + "&date=" + s + '&prefix=' + geo_fl_prefix;

  	geo_CreateXmlHttpObj();
	 
	  if(geo_XmlHttpObj)
	    { 
		  geo_XmlHttpObj.onreadystatechange = CityStateChangeHandler;
		  geo_XmlHttpObj.open("GET", requestUrl,  true);
		  geo_XmlHttpObj.send(null);		
	    }
}



function CityStateChangeHandler()
{
  if (  geo_XmlHttpObj.readyState == 4  )
     {
		 if( geo_XmlHttpObj.status == 200  )
		    {	
        document.getElementById('div_' + geo_fl_city).innerHTML =  geo_XmlHttpObj.responseText;
        window.status = "";								
		   }
		}   	   	
}

function myOnload(){
	
	if(typeof(document.getElementById(geo_fl_country)) != "undefined"
		||document.getElementById(geo_fl_country)!=null){
		document.getElementById(geo_fl_country).value=getCookie(geo_fl_country);
	}
	if(typeof(document.getElementById('div_' + geo_fl_region)) != "undefined" 
		|| document.getElementById('div_' + geo_fl_region) != null){
		document.getElementById('div_' + geo_fl_region).innerHTML=getCookie(geo_fl_region);
	}
	if(typeof(document.getElementById('div_' + geo_fl_city)) == "undefined"
		|| document.getElementById('div_' + geo_fl_city)!= null){
		document.getElementById('div_' + geo_fl_city).innerHTML=getCookie(geo_fl_city);
	}
}

function getCookie(name){
	var cookieString = new String(document.cookie);
	var cookieHeader = name+"=";
	var beginPosition = cookieString.indexOf(cookieHeader);
	if (beginPosition != -1)
	{
		return cookieString.substring(beginPosition + cookieHeader.length);
	}
}

window.unload  = function () {
	var Then = new Date();
	Then.setTime(Then.getTime() + 1*3600000 );
	document.cookie = "geo_fl_country="+document.getElementById(geo_fl_country).value+";expires="+ Then.toGMTString();
	document.cookie = "geo_fl_region="+document.getElementById('div_' + geo_fl_region).innerHTML+";expires="+ Then.toGMTString();
	document.cookie = "geo_fl_city="+document.getElementById('div_' + geo_fl_city).innerHTML+";expires="+ Then.toGMTString();
}
	

function yesno(msg)
{
var truthBeTold = confirm(msg);
if (!truthBeTold)
   {
   alert("CANCELLED!");
   return false;
   }
return true;
}


function current_date_txt()
{
	 var d,s;
	 d = new Date();
	 s = (d.getMonth() + 1) + '-'  ;
  	 s += d.getDate() + '-' ;
  	 s += d.getFullYear() + '-';
	 s += d.getHours() + '-' ;
  	 s += d.getMinutes() + '-';
  	 s += d.getSeconds();
  	 return s;
}

function getcookie(c_name)
{
if (document.cookie.length>0)
  {
  c_start=document.cookie.indexOf(c_name + "=");
  if (c_start!=-1)
    { 
    c_start=c_start + c_name.length+1; 
    c_end=document.cookie.indexOf(";",c_start);
    if (c_end==-1) c_end=document.cookie.length;
    return unescape(document.cookie.substring(c_start,c_end));
    } 
  }
return "";
}

function setcookie(cookieName,cookieValue,nDays) {
 var today = new Date();
 var expire = new Date();
 if (nDays==null || nDays==0) nDays=1;
 expire.setTime(today.getTime() + 3600000*24*nDays);
 document.cookie = cookieName+"="+escape(cookieValue)
                 + ";expires="+expire.toGMTString();
}
/*
var xmlHttp // xmlHttp variable

function GetXmlHttpObject(){ // This function we will use to call our xmlhttpobject.
var objXMLHttp=null // Sets objXMLHttp to null as default.
if (window.XMLHttpRequest){ // If we are using Netscape or any other browser than IE lets use xmlhttp.
objXMLHttp=new XMLHttpRequest() // Creates a xmlhttp request.
}else if (window.ActiveXObject){ // ElseIf we are using IE lets use Active X.
objXMLHttp=new ActiveXObject("Microsoft.XMLHTTP") // Creates a new Active X Object.
} // End ElseIf.
return objXMLHttp // Returns the xhttp object.
}// Close Function

function CheckUsername()
{
setcookie("username","",0);
setcookie("NickName","",0);
username=document.getElementById("NickName").value; // This function we will use to check to see if a username is taken or not.
alert(username);
xmlHttp=GetXmlHttpObject() // Creates a new Xmlhttp object.
if (xmlHttp==null){ // If it cannot create a new Xmlhttp object.
alert ("Browser does not support HTTP Request") // Alert Them!
return // Returns.
} // End If.

var url="checkname.php?username="+username // Url that we will use to check the username.
xmlHttp.open("GET",url,true) // Opens the URL using GET
xmlHttp.onreadystatechange = function () { // This is the most important piece of the puzzle, if onreadystatechange is equal to 4 than that means the request is done.
if (xmlHttp.readyState == 4) { // If the onreadystatechange is equal to 4 lets show the response text.
document.getElementById("usernameresult").innerHTML="";
document.getElementById("usernameresult").innerHTML = xmlHttp.responseText; // Updates the div with the response text from check.php
} // End If.
}; // Close Function
xmlHttp.send(null); // Sends NULL instead of sending data.
} // Close Function.
*/

function CheckUsername()
{
//setcookie("username","",0);
//setcookie("NickName","",0);
username=document.getElementById("NickName").value;
if(username=="")
		{
				alert("You must enter 'Username' first..");
				document.getElementById("NickName").focus();
				return false;
		}
		else
		{
			var d=current_date_txt();
			
			var args ="username="+username + "&d=" + d;
			
			
			var do_ajax = new Ajax.Request( site_url + "checkname.php", {method: 'get', parameters: args, onComplete: checkname_result,generateUniqueUrl: true });
		}

}

function checkname_result(request)
 {
 var response = request.responseText;	
 var div = document.getElementById('usernameresult');     
 div.innerHTML=response;	
 }

function checkIE(iWant)
{
bName = navigator.appName; //1
bVer = parseInt(navigator.appVersion); //2
if (bName == "Netscape" && bVer >= 4 && iWant == 'NS') 
   return true;
else if (bName == "Netscape" && bVer == 3) 
   return true;
else if (bName == "Netscape" && bVer == 2) //3
   return true;
else if (bName == "Microsoft Internet Explorer" && bVer >= 4 && iWant == 'IE' ) 
   return true;
else if (bName == "Microsoft Internet Explorer") 
   return true;
else
   return false;

}	


function MMS_PopWindow_showMe(title,msg,pw,ph,e){   
  var w=document.getElementById("MMS_PopWindow_titlebar");
  w.innerHTML=title;
  var w=document.getElementById("MMS_PopWindow_alertmsg");
  w.innerHTML=msg;   
  var w=document.getElementById("MMS_PopWindow");		
  w.style.visibility='visible';
  
  if ( checkIE('IE') )
     {
     winW = document.body.offsetWidth;
     tempX = event.clientX ;
     tempY = event.clientY ;
    
    if ( document.body && ( document.body.scrollTop || document.body.scrollLeft ) && !( window.opera || window.debug || navigator.vendor == 'KDE' ) )
				{
					tempX += document.body.scrollLeft; tempY += document.body.scrollTop;
				}
				else if ( document.documentElement && ( document.documentElement.scrollTop || document.documentElement.scrollLeft ) && !( window.opera || window.debug || navigator.vendor == 'KDE' ) )
				{
					tempX += document.documentElement.scrollLeft; tempY += document.documentElement.scrollTop;
				}
     }
  else
     {
     winW = window.innerWidth;
     tempX = e.pageX;
     tempY = e.pageY;
     }
     
  winW = ( winW / 2 ) - ( pw / 2) - 50
  tempY = tempY - 50       
  w.style.left   = winW +'px';
  w.style.top    = tempY +'px';
  w.style.width  = pw + 'px';
  w.style.height = ph + 'px';

  }
  
function MMS_removePopWindow(sid)
{

  var owin_msg = document.getElementById("MMS_PopWindow_alertmsg");
  owin_msg.innerHTML ="";
  
  var oPopWindow_header    = document.getElementById("MMS_PopWindow_header");   
  oPopWindow_header.innerHTML="";
   
  idWindow = document.getElementById(sid);
  idWindow.style.visibility='hidden';
  //document.body.removeChild(idWindow);
  
  var oshadow    = document.getElementById("MMS_shadow");
  oshadow.className="MMS_shadow_hidden";
  
  
}


function required_char_counter(objtext,objinput,char_min,char_max)
{
  var label      = document.getElementById(objtext + 'label_character_counter');
  var objtext    = document.getElementById(objtext);  
  var objinput   = document.getElementById(objinput);  
  var ncharcount = char_min - objtext.value.length;
    
  if ( ncharcount > 0 )
     {    
     label.innerHTML = lang_character_counter_required;
     objinput.value = ncharcount;
     }
  else
     {
     label.innerHTML = lang_character_counter_remaining;
     objinput.style.width="60px";
     if ( char_max == 0 ) // unlimited max
        {
        objinput.value = '0'; 
        }
     else
        {        
        objinput.value = char_max - objtext.value.length;
        }   
     }             
}

function wherechildren(objWhereChildren,field) // see wherechildren code in inc/profile_disp.inc.php
{
//var objChildren = document.getElementById("js_Children");

//var objChildrenValue = document.getElementById("Children");

var objChildren = document.getElementById("js_" + field);

var objChildrenValue = document.getElementById(field);

var n = objWhereChildren.value
if ( n > 10 && n <= 40 )
    {
    //objChildren.style.position='relative';
    objChildren.style.position='';
    objChildren.style.visibility='visible';
    //objChildren.style.height='10px';     
    }   
else
    {
    objChildren.style.position='absolute';
    objChildren.style.visibility='hidden';
    //objChildren.style.height='1px';
    objChildrenValue.value='5';
    }    
}






function doSecInt(id)
{

	id=Number(id);
	if(id ==10)
	{		
		document.getElementById('Relationship_cas').disabled='true';
		document.getElementById('Relationship_ser').disabled='';
		document.getElementById('Relationship_mar').disabled='';
		document.getElementById('Relationship_fri').disabled='';
		document.getElementById('Relationship_bus').disabled='';
		document.getElementById('Relationship_sug').disabled='';
	}	
	else if(id ==20)
	{		
		document.getElementById('Relationship_cas').disabled='';
		document.getElementById('Relationship_ser').disabled='true';
		document.getElementById('Relationship_mar').disabled='';
		document.getElementById('Relationship_fri').disabled='';
		document.getElementById('Relationship_bus').disabled='';
		document.getElementById('Relationship_sug').disabled='';
	}
	else if(id ==30)
	{		
		document.getElementById('Relationship_cas').disabled='';
		document.getElementById('Relationship_ser').disabled='';
		document.getElementById('Relationship_mar').disabled='true';
		document.getElementById('Relationship_fri').disabled='';
		document.getElementById('Relationship_bus').disabled='';
		document.getElementById('Relationship_sug').disabled='';
	}
	else if(id ==40)
	{		
		document.getElementById('Relationship_cas').disabled='';
		document.getElementById('Relationship_ser').disabled='';
		document.getElementById('Relationship_mar').disabled='';
		document.getElementById('Relationship_fri').disabled='true';
		document.getElementById('Relationship_bus').disabled='';
		document.getElementById('Relationship_sug').disabled='';
	}
	else if(id ==50)
	{		
		document.getElementById('Relationship_cas').disabled='';
		document.getElementById('Relationship_ser').disabled='';
		document.getElementById('Relationship_mar').disabled='';
		document.getElementById('Relationship_fri').disabled='';
		document.getElementById('Relationship_bus').disabled='true';
		document.getElementById('Relationship_sug').disabled='';
	}	
	else if(id ==60)
	{		
		document.getElementById('Relationship_cas').disabled='';
		document.getElementById('Relationship_ser').disabled='';
		document.getElementById('Relationship_mar').disabled='';
		document.getElementById('Relationship_fri').disabled='';
		document.getElementById('Relationship_bus').disabled='';
		document.getElementById('Relationship_sug').disabled='true';
	}else if(id==70)
	{
	
		document.getElementById('Relationship_cas').disabled='';
		document.getElementById('Relationship_ser').disabled='';
		document.getElementById('Relationship_mar').disabled='';
		document.getElementById('Relationship_fri').disabled='';
		document.getElementById('Relationship_bus').disabled='';
		document.getElementById('Relationship_sug').disabled='';
		document.getElementById('Relationship_men').disabled='true'
	
	}

	

}

function checkedAll(ids,first)
{
	//alert(ids+" - "+ first);
	var arrIds;
	arrIds=ids.split(",");
	var divIds;
	var chkAlls="checkall_"+first;
	//alert("checkall_"+first);
	if(document.getElementById(chkAlls).checked==0)
	{
		for(i=0;i<arrIds.length; i++)
		{
			
			divIds=first+"_"+arrIds[i];
			if(!document.getElementById(divIds)) continue;
			document.getElementById(divIds).checked=''	
		}
	}else
	{
		
		for(i=0;i<arrIds.length; i++)
		{
			
			divIds=first+"_"+arrIds[i];
			if(!document.getElementById(divIds)) continue;

			if(document.getElementById(divIds).disabled=='')				
			document.getElementById(divIds).checked='true';
				//alert(divIds);
		}
	
	}
	//var show=ids+" - "+first;
	//document.getElementById('').checked='true'
	
}

function toggleShowSpace()
{
	
	
if(document.getElementById('js_myspace').style.display=='block')
	{
	document.getElementById('js_myspace').style.display='none';
	}
	else
	{
	
	document.getElementById('js_myspace').style.display='block';
	}
}


function confirmation(spam,senderID)
	{
		
	var answer = confirm("Are you sure you want to report this user as a spammer/abuser?");
	if (answer)
	{
		var win="width=500,height=200,menubar=no,status=no,resizeable=no,scrollbars=no,toolbar=no,location=no";
	    window.open( "list_pop.php?action=spam&ID="+senderID,'',win);
	}
	} 

	
/*function delete_message(id)
{


//alert("hi naresh");
alert(id);
//alert(rid);
   
	var xmlHttp;
	if(window.XMLHttpRequest)
	{
	xmlHttp=new XMLHttpRequest(); 
	}else if(window.ActiveXObject)
	{
	xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
	
	}

	if(xmlHttp)
	{
		//var url="Popularindex.php";
		var random_num = (Math.round((Math.random()*9)+1));
		var url="del_message.php?id="+id;
		//var url="del_message.php?id="+"&rid="+rid;

		xmlHttp.open('GET', url, true);
		var strParam="autoPlay=true";
		xmlHttp.send(strParam);
   // xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
		xmlHttp.onreadystatechange=function()
      {
      if(xmlHttp.readyState==4)
        {
		  if(xmlHttp.status==200)
			{
			  var getVal = xmlHttp.responseText;
			//alert(getVal); //MY ALERT SHOWS A NULL
			if(getVal == null) 
				{
				alert("really value are null");
				}
		//alert(xmlHttp.responseText);
        //document.getElementById("popular").innerHTML=xmlHttp.responseText;
		window.location.href="inbox.php?val=1&leftnav=0";
			}
        }else
		  {
			alert("i am in else loop");
		}
      }
	  
		//alert(url);
		
	//xmlHttp.ope;n("GET",url);
		
    //var strParam="autoPlay=true";
	//xmlHttp.send(strParam);
    
}

}
*/




function confirmation_any()
	{		
	var answer = confirm("Are you sure ?");
	if (answer)
		 return true;
	else
		 return false;
	}	

function confirmation_trash()
	{
		
	var answer = confirm("Are you sure ?");
	if (answer)
	{
		
		return true;
	}
	else
		{
		
		return false;
		}	} 
	

 var checkflag = 'false';

 function checkAll2(id)
 { // alert(id);
 //var checkflag = 'false';
   //var field=new Array();
	 var  f=document.getElementsByTagName("input");
//alert(checkflag);
if(checkflag == 'false')
	 {
for (var i = 0; i < f.length; i++) {
myType = f[i].getAttribute("type");
if ( myType == "checkbox") {
f[i].checked=1;
checkflag = 'true';
}
}
	 }
	 else{
	 
	 for (var i = 0; i < f.length; i++) {
myType = f[i].getAttribute("type");
if ( myType == "checkbox") {
f[i].checked=0;
checkflag = 'false';
}
}
	 
	 }


//var field=document.getElementById('single[]');
	// var field=document.getElementsByName('181');
//alert(f.length);
	 //alert(field.elements.length);
	/*alert(field.length);
	                  if (checkflag == 'false') {
                       for (i = 0; i < field.length; i++) {
                       field[i].checked = true;}
                      checkflag = 'true';
                       }
                      else {
                       for (i = 0; i < field.length; i++) {
                        field[i].checked = false; }
                       checkflag = 'false';
                       }

*/
                      
}

/*function checkedAll2(id)
=======
/*function checkAll2(id)
>>>>>>> .r1456
{
	alert(id);
     var aa= document.getElementById(id);
	 if (aa.checked == false)
          {
          aa.checked = true
          }
        else
          {
          aa.checked = false
          }
	for (var i =0; i < aa.element.length; i++) 
	{
	 aa.checked[i].checked = aa.checked;
	}

      }*/


	 /* var checkflag = "false";

function checkAll() {
	alert(id);
	var field=document.getElementById['checkall2[]'];
if (checkflag == "false") {
for (i = 0; i < field.length; i++) {
field[i].checked = true;}
checkflag = "true";
 }
else {
for (i = 0; i < field.length; i++) {
field[i].checked = false; }
checkflag = "false";
 }
}

*/

function saved_message(id)
{

//alert("hi amit");
//alert(id);
//alert(rid);
   
	var xmlHttp;
	if(window.XMLHttpRequest)
	{
	xmlHttp=new XMLHttpRequest(); 
	}else if(window.ActiveXObject)
	{
	xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
	
	}
	if(xmlHttp)
	{
		
		var random_num = (Math.round((Math.random()*9)+1));
		var url="saved_message.php?id="+id;
		
		xmlHttp.open('GET', url, true);
   // xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
		xmlHttp.onreadystatechange=function()
      {

		

      if(xmlHttp.readyState==4)
        {
		  if(xmlHttp.status==200)
			{
			  var getVal = xmlHttp.responseText;
			//alert(getVal); //MY ALERT SHOWS A NULL
			if(getVal == null) 
				{
				alert("really value are null");
				}
		//alert(xmlHttp.responseText);
        //document.getElementById("popular").innerHTML=xmlHttp.responseText;
		window.location.href="inbox.php?val=1&leftnav=0";
			}
        }
      }
	  
		//alert(url);
		
	//xmlHttp.ope;n("GET",url);
		
    var strParam="autoPlay=true";
	//xmlHttp.send(strParam);
    xmlHttp.send(null);
}

}


function back_inbox(id)
{

//alert("hi amit");
//alert(id);
//alert(rid);
   
	var xmlHttp;
	if(window.XMLHttpRequest)
	{
	xmlHttp=new XMLHttpRequest(); 
	}else if(window.ActiveXObject)
	{
	xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
	
	}
	if(xmlHttp)
	{
		
		var random_num = (Math.round((Math.random()*9)+1));
		var url="back_inbox.php?id="+id+"&val=1&leftnav=0";
		
		xmlHttp.open('GET', url, true);
   // xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
		xmlHttp.onreadystatechange=function()
      {

		

      if(xmlHttp.readyState==4)
        {
		  if(xmlHttp.status==200)
			{
			  var getVal = xmlHttp.responseText;
			//alert(getVal); //MY ALERT SHOWS A NULL
			if(getVal == null) 
				{
				alert("really value are null");
				}
		//alert(xmlHttp.responseText);
        //document.getElementById("popular").innerHTML=xmlHttp.responseText;
		window.location.href="saved_inbox.php?val=1&leftnav=0";
			}
        }
      }
	  
		//alert(url);
		
	//xmlHttp.ope;n("GET",url);
		
    var strParam="autoPlay=true";
	//xmlHttp.send(strParam);
    xmlHttp.send(null);
}

}

function trash_inbox(id)
{

//alert("hi amit");
//alert(id);
//alert(rid);
   
	var xmlHttp;
	if(window.XMLHttpRequest)
	{
	xmlHttp=new XMLHttpRequest(); 
	}else if(window.ActiveXObject)
	{
	xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
	
	}
	if(xmlHttp)
	{
		
		var random_num = (Math.round((Math.random()*9)+1));
		var url="back_inbox.php?id="+id+"&val=1&leftnav=0";
		
		xmlHttp.open('GET', url, true);
   // xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
		xmlHttp.onreadystatechange=function()
      {

		

      if(xmlHttp.readyState==4)
        {
		  if(xmlHttp.status==200)
			{
			  var getVal = xmlHttp.responseText;
			//alert(getVal); //MY ALERT SHOWS A NULL
			if(getVal == null) 
				{
				alert("really value are null");
				}
		//alert(xmlHttp.responseText);
        //document.getElementById("popular").innerHTML=xmlHttp.responseText;
		window.location.href="trash.php?val=1&leftnav=0";
			}
        }
      }
	  
		//alert(url);
		
	//xmlHttp.ope;n("GET",url);
		
    var strParam="autoPlay=true";
	//xmlHttp.send(strParam);
    xmlHttp.send(null);
}

}


/*function delete_message(id)
{

	alert("naresh123"+id);

	var xmlHttp;
	try
    {
    // Firefox, Opera 8.0+, Safari
    xmlHttp=new XMLHttpRequest();
    }
  catch (e)
    {
    // Internet Explorer
    try
      {
      xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
      }
    catch (e)
      {
      try
        {
        xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
        }
      catch (e)
        {
        alert("Your browser does not support AJAX!");
        return false;
        }
      }
    }
	var url="del_message.php?id="+id;
		alert(url);
		
	xmlHttp.open("GET",url,true);
		
    
    xmlHttp.send(null);

	xmlHttp.onreadystatechange=function()
      {
		alert("readystate value is"+xmlHttp.readyState);
		alert("xmlHttp.status value is"+xmlHttp.status);
      if(xmlHttp.readyState==4)
        {
		  alert("xmlHttp.status value is"+xmlHttp.status);
		  if(xmlHttp.status==200)
			{
			  var getVal = xmlHttp.responseText;
			alert(getVal); //MY ALERT SHOWS A NULL
			if(getVal == null) 
				{
				alert("really value are null");
				}//but my null comparison fails
		 alert("resultset is"+xmlHttp.responseText);
		
			}else
			{
			alert("i am for status ");
			}
        }else
		  {
		alert("i am in else for readystate");
		}
      }
	 



}
*/

function GetXmlHttpObject()
{
	//alert("i am in 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;
}

function delete_message(id) 
{
	//alert("message id is"+id);

var xmlHttp;
try
  {
  // Firefox, Opera 8.0+, Safari
  xmlHttp=new XMLHttpRequest();
  }
catch (e)
  {
  // Internet Explorer
  try
    {
    xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
    }
  catch (e)
    {
    try
      {
      xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
      }
    catch (e)
      {
      alert("Your browser does not support AJAX!");
      return false;
      }
    }
  }
//xmlHttp=GetXmlHttpObject();
//alert("xmlttp value is"+xmlHttp);
//if (xmlHttp==null)
 // {
 // alert ("Your browser does not support AJAX!");
  //return;
 // }
 //if(window.XMLHttpRequest)
//{
//xmlHttp=new XMLHttpRequest();
//}
//else if(window.ActiveXObject)
//{
//xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
//}
//alert("xmlttp value is"+xmlHttp);
 xmlHttp.onreadystatechange=function()
    {
    if(xmlHttp.readyState==4)
      {
     // alert("what is here"+xmlHttp.responseText);
      }
    }
var url="del_message.php";
url=url+"?id="+id;
//url=url+"&sid="+Math.random();
//alert(url);
//xmlHttp.onreadystatechange=Changestate;
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
//} 
}
function Changestate() 
{ //alert("readystate is"+xmlHttp.readyState);
if (xmlHttp.readyState == 4)
{ 
	 if (xmlHttp.status == 200)
	{
	 
//alert(xmlHttp.responseText);
}
}
}



function delete_message1(id)
{
//alert("message id is"+id);
var xmlHttp1;



xmlHttp=GetXmlHttpObject();
//alert("xmlttp value is"+xmlHttp);
if (xmlHttp==null)
  {
  alert ("Your browser does not support AJAX!");
  return;
  } else
	{
  //alert("supported");
  }
var url="del_message.php";
url=url+"?id="+id;
url=url+"&sid="+Math.random();
//alert(url);
xmlHttp.onreadystatechange=stateChanged1;
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
}


function stateChanged1() 
{ //alert("readystate is"+xmlHttp.readyState);
if (xmlHttp.readyState==4)
{ 
//alert(xmlHttp.responseText);
}
}


function submitForm(val)
{
if(val=="0")
	{

document.getElementById("msg_form_submit1").value="DELETE";
document.msg_form.submit();
}
else
if(val=="1")
	{

document.getElementById("msg_form_submit1").value="MarkasNew";
document.msg_form.submit();

	}


	else
if(val=="2")
	{

document.getElementById("msg_form_submit1").value="Markasold";
document.msg_form.submit();

	}
	else
if(val=="3")
	{

document.getElementById("msg_form_submit1").value="SaveToFolder";
document.msg_form.submit();

	}
else
if(val=="4")
	{

document.getElementById("msg_form_submit1").value="BackToInbox";
document.msg_form.submit();

	}
else
if(val=="5")
	{

document.getElementById("msg_form_submit1").value="DeleteForever";
document.msg_form.submit();

	}

}


function delete_forever(id) 
{
	//alert("message id is"+id);

var xmlHttp;



xmlHttp=GetXmlHttpObject();
//alert("xmlttp value is"+xmlHttp);

if (xmlHttp==null)
  {
  alert ("Your browser does not support AJAX!");
  return;
  } else
	{
  //alert("supported");
  }
var url="del_forever.php";
url=url+"?id="+id;
url=url+"&sid="+Math.random();
//alert(url);
xmlHttp.onreadystatechange=stateChanged;
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
//} 
}
function stateChanged2() 
{ //alert("readystate is"+xmlHttp.readyState);
if (xmlHttp.readyState==4)
{ 
//alert(xmlHttp.responseText);
}
}


function del_whoview_me(profileid)
{
//alert("hi"+profileid);
return false;
}
function del_whoview_me(profileid)
{
//memberid,profileid
	//alert("profileid is"+profileid);
	//return false;
var xmlHttp1;



xmlHttp=GetXmlHttpObject();
//alert("xmlttp value is"+xmlHttp);
if (xmlHttp==null)
  {
  //alert ("Your browser does not support AJAX!");
  return;
  } else
	{
  //alert("supported");
  }
var url="del_whoview_me.php?profileid="+profileid;
//url=url+"?id="+id;
url=url+"&sid="+Math.random();
//alert(url);
xmlHttp.onreadystatechange=stateChanged2;
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
}

function del_who_i_viewed(profileid)
{
//memberid,profileid
	//alert("profileid is"+profileid);
	//return false;
var xmlHttp1;



xmlHttp=GetXmlHttpObject();
//alert("xmlttp value is"+xmlHttp);
if (xmlHttp==null)
  {
  alert ("Your browser does not support AJAX!");
  return;
  } else
	{
  //alert("supported");
  }
var url="del_who_i_viewed.php?profileid="+profileid;
//url=url+"?id="+id;
url=url+"&sid="+Math.random();
//alert(url);
xmlHttp.onreadystatechange=stateChanged2;
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
}
function del_wink(profileid)
{
	//alert("profileid is"+profileid);
	var xmlHttp1;



xmlHttp=GetXmlHttpObject();
//alert("xmlttp value is"+xmlHttp);
if (xmlHttp==null)
  {
  alert ("Your browser does not support AJAX!");
  return;
  } else
	{
  //alert("supported");
  }
var url="del_wink.php?profileid="+profileid;
//url=url+"?id="+id;
url=url+"&sid="+Math.random();
//alert(url);
xmlHttp.onreadystatechange=stateChanged4;
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
}
function stateChanged2() 
{
	//alert("readystate is"+xmlHttp.readyState);
if (xmlHttp.readyState==4)
{ 
//alert(xmlHttp.responseText);
}
}

function stateChanged4() 
{ 
	//alert("readystate is"+xmlHttp.readyState);
if (xmlHttp.readyState==4)
{
	//alert("i am four");
window.location.href="winks.php?val=1&leftnav=3";
}
}

function del_favorites(profileid)
{

//alert("profileid is"+profileid);
//return false;
	var xmlHttp1;

	if(confirm("Are you sure you want to delete this user?"))
	{

		xmlHttp=GetXmlHttpObject();
		//alert("xmlttp value is"+xmlHttp);
		if (xmlHttp==null)
		  {
		  alert ("Your browser does not support AJAX!");
		  return;
		  } else
			{
		  //alert("supported");
		  }
		var url="del_favorites.php?profileid="+profileid+"val=1&leftnav=3";
		//url=url+"?id="+id;
		url=url+"&sid="+Math.random();
		//alert(url);
		xmlHttp.onreadystatechange=stateChanged5;
		xmlHttp.open("GET",url,true);
		xmlHttp.send(null);
	}

}




function stateChanged5() 
{ 
	//alert("readystate is"+xmlHttp.readyState);
if (xmlHttp.readyState==4)
{
	//alert("i am four");
window.location.href="favorites.php?val=1&leftnav=3";
}
}



function del_wink_cc(profileid)
{
	//alert("profileid is"+profileid);
	var xmlHttp1;



xmlHttp=GetXmlHttpObject();
//alert("xmlttp value is"+xmlHttp);
if (xmlHttp==null)
  {
  alert ("Your browser does not support AJAX!");
  return;
  } else
	{
  //alert("supported");
  }
var url="del_wink.php?profileid="+profileid;
//url=url+"?id="+id;
url=url+"&sid="+Math.random();
//alert(url);
xmlHttp.onreadystatechange=stateChanged7;
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
}
function stateChanged7() 
{
	//alert("readystate is"+xmlHttp.readyState);
if (xmlHttp.readyState==7)
{ 
//alert(xmlHttp.responseText);
}
}


function del_favoritesmade(profileid)
{

//alert("profileid is"+profileid);
//return false;
	var xmlHttp1;



xmlHttp=GetXmlHttpObject();
//alert("xmlttp value is"+xmlHttp);
if (xmlHttp==null)
  {
  alert ("Your browser does not support AJAX!");
  return;
  } else
	{
  //alert("supported");
  }
var url="del_favoritesmade.php?profileid="+profileid;
//url=url+"?id="+id;
url=url+"&sid="+Math.random();
//alert(url);
xmlHttp.onreadystatechange=stateChanged5;
xmlHttp.open("GET",url,true);
xmlHttp.send(null);

}




function stateChanged5() 
{ 
	//alert("readystate is"+xmlHttp.readyState);
if (xmlHttp.readyState==4)
{
	//alert("i am four");
window.location.href="favorites.php?val=1&leftnav=3";
}
}







function checkbox_disabled(id)
{	
	var id=Number(id);


	if(id == 0)
	{		
		document.getElementById('ment').disabled='';
		document.getElementById('cas').disabled='';
		document.getElementById('ser').disabled='';
		document.getElementById('mar').disabled='';
		document.getElementById('fri').disabled='';
		document.getElementById('bus').disabled='';
		document.getElementById('sug').disabled='';
	    document.getElementById('ben').disabled='';
	    
		}	
	else if(id ==10)
	{		
		document.getElementById('ment').disabled='';
		document.getElementById('cas').checked='';
		document.getElementById('cas').disabled='true';
		document.getElementById('ser').disabled='';
		document.getElementById('mar').disabled='';
		document.getElementById('fri').disabled='';
		document.getElementById('bus').disabled='';
		document.getElementById('sug').disabled='';
	    document.getElementById('ben').disabled='';
	    
		}	
		
	else if(id ==20)
	{		
		document.getElementById('cas').disabled='';
		 document.getElementById('ben').disabled='';
		 document.getElementById('ser').checked='';
	   document.getElementById('ser').disabled='true';
		document.getElementById('mar').disabled='';
		document.getElementById('fri').disabled='';
		document.getElementById('bus').disabled='';
		document.getElementById('sug').disabled='';
        document.getElementById('ment').disabled='';
	
	}
	else if(id ==30)
	{		
		
		document.getElementById('cas').disabled='';
		document.getElementById('ser').disabled='';
		document.getElementById('ben').disabled='';
		document.getElementById('mar').checked='';
		document.getElementById('mar').disabled='true';
		document.getElementById('fri').disabled='';
		document.getElementById('bus').disabled='';
		document.getElementById('sug').disabled='';
	    document.getElementById('ment').disabled='';
	
	
	}
	else if(id ==40)
	{		
		document.getElementById('cas').disabled='';
		document.getElementById('ser').disabled='';
		document.getElementById('mar').disabled='';
	    document.getElementById('ben').disabled='';
		 document.getElementById('ment').disabled='';
		 document.getElementById('fri').checked='';
		document.getElementById('fri').disabled='true';
		document.getElementById('bus').disabled='';
		document.getElementById('sug').disabled='';
	   			
		
		}
	else if(id ==50)
	{		
		
		document.getElementById('cas').disabled='';
		document.getElementById('ser').disabled='';
		document.getElementById('mar').disabled='';
		document.getElementById('fri').disabled='';
		document.getElementById('ben').disabled='';
		document.getElementById('ment').disabled='';
		document.getElementById('bus').checked='';
		document.getElementById('bus').disabled='true';
		document.getElementById('sug').disabled='';
		
	 	}	
	else if(id == 60)
	{		
		window.open("benefactordetails.php","mywindow","width=600,height=300,menubar=no,status=no,resizable=yes,scrollbars=yes,toolbar=no,location=no");
		document.getElementById('cas').disabled='';
		document.getElementById('ser').disabled='';
		document.getElementById('mar').disabled='';
		document.getElementById('fri').disabled='';
		document.getElementById('bus').disabled='';
		document.getElementById('ben').checked='';
		document.getElementById('ben').disabled='true';
		document.getElementById('ment').disabled=''
		document.getElementById('sug').disabled='';
		
	    
	}else if(id == 70)
	{
	
		document.getElementById('cas').disabled='';
		document.getElementById('ser').disabled='';
		document.getElementById('mar').disabled='';
		document.getElementById('fri').disabled='';
		document.getElementById('bus').disabled='';
		document.getElementById('ben').disabled='';
		document.getElementById('ment').checked='';
		document.getElementById('ment').disabled='true';
		document.getElementById('sug').disabled='';
	    
	}

	

}



// :::::::::::::::::::::::::
// ::: Scroll Functions ::
// :::::::::::::::::::::::::

function moveLeft(photoarray)
{
	var arrayLength=0;
	var photoTitle="";
	var tempArray=new Array();
	var tempArray1=new Array();
	tempArray=photoarray.split('M{,oIA');
	arrayLength=tempArray.length;
	
ContainerElement=document.getElementById("mainpic");
oldImagePath=ContainerElement.src;
oldImageIndexPos=oldImagePath.lastIndexOf("/");
oldImageName=oldImagePath.substr(oldImageIndexPos+1);

for(i=0;i<arrayLength;i++)
	{
	tempArray1 = tempArray[i].split("|");
	
	if(tempArray1[0]==oldImageName)
		{
		oldImageIndex=i;
		break;
		}
	}

if(oldImageIndex==0)
	{ newImageIndex=arrayLength-1; }
else
	{ newImageIndex=oldImageIndex-1; }


//newImageName=tempArray[newImageIndex];
tempArray1 = tempArray[newImageIndex].split("|");
newImageName = tempArray1[0];
global_disp_image_width  = tempArray1[1];
global_disp_image_height =tempArray1[2];
global_disp_image_prefix =tempArray1[3];
newImagePath=oldImagePath.replace(oldImageName,newImageName);
ContainerElement.src=newImagePath;
/*
if(tempArray1[4] == ""){
	photoTitle="no Title";
}else{
	photoTitle=tempArray1[4];
}*/
photoTitle=tempArray1[4];

ContainerElement.alt=photoTitle;

var photo_title=document.getElementById("photo_title");
photo_title.innerHTML=photoTitle;

photoRating=tempArray1[5];
}

function moveRight(photoarray)
{
	var arrayLength=0;
	var photoTitle="";
	var tempArray=new Array();
	var tempArray1=new Array();
	tempArray=photoarray.split('M{,oIA');
	arrayLength=tempArray.length;
	
ContainerElement=document.getElementById("mainpic");
oldImagePath=ContainerElement.src;
oldImageIndexPos=oldImagePath.lastIndexOf("/");
oldImageName=oldImagePath.substr(oldImageIndexPos+1);

for(i=0;i<arrayLength;i++)
	{
	tempArray1 = tempArray[i].split("|");
	
	if(tempArray1[0]==oldImageName)
		{
		oldImageIndex=i;
		break;
		}
	}

if(oldImageIndex==(arrayLength-1))
	{ newImageIndex=0; }
else
	{ newImageIndex=oldImageIndex+1; }


//newImageName=tempArray[newImageIndex];
tempArray1 = tempArray[newImageIndex].split("|");
newImageName = tempArray1[0];
global_disp_image_width  = tempArray1[1];
global_disp_image_height =tempArray1[2];
global_disp_image_prefix =tempArray1[3];
newImagePath=oldImagePath.replace(oldImageName,newImageName);
ContainerElement.src=newImagePath;
/*
if(tempArray1[4] == ""){
	photoTitle="no Title";
}else{
	photoTitle=tempArray1[4];
}*/
photoTitle=tempArray1[4];

ContainerElement.alt=photoTitle;

var photo_title=document.getElementById("photo_title");
photo_title.innerHTML=photoTitle;

photoRating=tempArray1[5];

}



function doSecInt1()
{
	//alert("hi");
document.getElementById("showallcountry1").style.display='none';
if(window.XMLHttpRequest)
{
http=new XMLHttpRequest();
}
else if(window.ActiveXObject)
{
http=new ActiveXObject("Microsoft.XMLHTTP");
}

var getvat = document.getElementById('PrimaryRelationship').value;


var url="get_all_city.php?id="+getvat;
//alert(url);

http.open("GET", url , true);

http.onreadystatechange = countryprocess;

http.send(null);

}

function countryprocess()
{
if (http.readyState == 4) {

if(http.status==200)
{
var showcountry1=document.getElementById('showallcountry1');
var showcountry=document.getElementById('showallcountry');
showcountry.style.display='none';
showcountry1.style.display='block';
//alert(http.responseText);
showcountry1.innerHTML=http.responseText;
}
}
}
function doSecInt2()
{
	//alert("hi");
document.getElementById("showallcountry1").style.display='none';
if(window.XMLHttpRequest)
{
http=new XMLHttpRequest();
}
else if(window.ActiveXObject)
{
http=new ActiveXObject("Microsoft.XMLHTTP");
}

var getvat = document.getElementById('PrimaryRelationship').value;


var url="get_none_city.php?id="+getvat;
//alert(url);

http.open("GET", url , true);

http.onreadystatechange = countryprocess2;

http.send(null);

}

function countryprocess2()
{
if (http.readyState == 4) {

if(http.status==200)
{
	//alert("countryprocess2");
var showcountry1=document.getElementById('showallcountry1');
var showcountry=document.getElementById('showallcountry');
showcountry.style.display='none';
showcountry1.style.display='block';
//alert(http.responseText);
showcountry1.innerHTML=http.responseText;
}
}
}
function doSecIntcity()
{
	//alert("hi  i  am for get city");
document.getElementById("showcity1").style.display='none';
if(window.XMLHttpRequest)
{
http=new XMLHttpRequest();
}
else if(window.ActiveXObject)
{
http=new ActiveXObject("Microsoft.XMLHTTP");
}

var getcountry = document.getElementById('PrimaryRelationship').value;
var getregion=document.getElementById('select3').value;
var url1="nearest_city.php?cid="+getcountry+"&rid="+getregion;
//alert(url1);

http.open("GET", url1 , true);

http.onreadystatechange = cityprocess;

http.send(null);

}

function cityprocess()
{
if (http.readyState == 4) {

if(http.status==200)
{

var showcity1=document.getElementById('showcity1');
var showcity=document.getElementById('showcity');
showcity.style.display='none';
showcity1.style.display='block';
//alert(http.responseText);

showcity1.innerHTML=http.responseText;
}

}
}

function doSecIntcity1()
{
	//alert("hi  i  am for get city");
document.getElementById("showcity1").style.display='none';
if(window.XMLHttpRequest)
{
http=new XMLHttpRequest();
}
else if(window.ActiveXObject)
{
http=new ActiveXObject("Microsoft.XMLHTTP");
}
//alert("hi");
var getcountry = document.getElementById('PrimaryRelationship').value;
var getregion=document.getElementById('select4').value;


var url1="nearest_city.php?cid="+getcountry+"&rid="+getregion;
//alert(url1);

http.open("GET", url1 , true);

http.onreadystatechange = cityprocess1;

http.send(null);

}

function cityprocess1()
{
if (http.readyState == 4) {

if(http.status==200)
{

var showcity1=document.getElementById('showcity1');
var showcity=document.getElementById('showcity');
showcity.style.display='none';
showcity1.style.display='block';
//alert(http.responseText);

showcity1.innerHTML=http.responseText;
}

}
}
function disable_chkbox(par)
{

if(par!=30)
{

document.getElementById('no_want_kids').style.display='none';
}
else
{
	
document.getElementById('no_want_kids').style.display='';
}
}



function disable_chkbo(ABC)
{
if((ABC=="10")||(ABC=="999"))
{
document.getElementById('select_have_kids').style.display='none';
}
else
{
document.getElementById('select_have_kids').style.display='';
}
}


///////function for iamge pop up for profile.php //////

function disp_image(pW,pH,pPrefix)
{

var W = global_disp_image_width;
var H = global_disp_image_height;
if ( W == 0 || H == 0)
   {
     W= pW;
     H= pH;
     global_disp_image_prefix = pPrefix;
   }
W = ( W * 1 ) + 40;
H = ( H * 1 ) + 40;

var ipath=document.getElementById("mainpic");
var ipathshow=ipath.src;
var ititle=ipath.alt;
if ( global_disp_image_prefix =='o')
   {
  ipathshow = ipathshow.replace('photo','orig');
   }
if ( global_disp_image_prefix =='main')
{
ipathshow = ipathshow.replace('photomain','orig');
}

//my_window= window.open ("display_image.php?iname="+ipathshow, "mywindow1","status=1,width="+W+",height="+H+",resizable=yes,scrollbars=1");
my_window= window.open ("display_image.php?iname="+ipathshow+"&ititle="+ititle, "mywindow1","status=1,width="+W+",height="+H+",resizable=yes,scrollbars=1");
       
iname="";
ipath="";
ititle=""
}
function disp_image_editable(pW,pH,pPrefix)
{
  
  var W = global_disp_image_width;
  var H = global_disp_image_height;
  if ( W == 0 || H == 0)
  {
    W= pW;
    H= pH;
    global_disp_image_prefix = pPrefix;
  }
  W = ( W * 1 ) + 40;
  H = ( H * 1 ) + 40;
  
  var ipath=document.getElementById("mainpic");
  var ipathshow=ipath.src;
  var ititle=ipath.alt;
  if ( global_disp_image_prefix =='o')
  {
    ipathshow = ipathshow.replace('photo','orig');
  }
  
//my_window= window.open ("display_image.php?iname="+ipathshow, "mywindow1","status=1,width="+W+",height="+H+",resizable=yes,scrollbars=1");
  my_window= window.open ("admin/display_image_edit.php?iname="+ipathshow+"&ititle="+ititle, "mywindow1","status=1,width="+W+",height="+H+",resizable=yes,scrollbars=1");
  
  iname="";
  ipath="";
  ititle=""
}
function roll(img_src,pW,pH,pPrefix,pClicked,stitle, rating)
{
   
   if ( global_roll_image_clicked == 1 && pClicked == 0)
      return true;
   
   if( pClicked == 1 )
      global_roll_image_clicked = 1
     
   
      
	 global_disp_image_prefix = pPrefix
	 global_disp_image_width  = pW
	 global_disp_image_height = pH
	 var oOldImg = document.getElementById("mainpic");
	oOldImg.src = img_src;
	document["mainpic"].src= img_src;
	/*
	if(stitle == ""){
		stitle="no Title";
	}
	*/
	document["mainpic"].alt=stitle;
	
	var photo_title=document.getElementById("photo_title");
  photo_title.innerHTML=stitle;

}


function message_box_center(msg,w,h,hdr)
{
  var owin    = document.getElementById("MMS_PopWindow");
	var owin_msg = document.getElementById("MMS_PopWindow_alertmsg");
	var owin_hdr = document.getElementById("MMS_PopWindow_header");
	var field_to_focus = document.getElementById("cursor_beacon");
	
	
	if ( typeof(hdr) == "undefined" )
	   {
	   var hdr="";
	   }
	  
	owin.style.visibility    = "visible";
	owin_msg.style.fontSize  = "13px";
	owin_msg.style.textalign = "center";
	owin_msg.innerHTML       = msg;
	owin_hdr.innerHTML       = hdr;
	owin_msg.height          =  h + 'px';
	owin.style.width         = w + 'px';
	owin.style.height        = h + 'px';	
	
	if ( checkIE('IE') )
     {
     winW = document.body.offsetWidth;     
     }
  else
     {
     winW = window.innerWidth;     
     }
  
  var nleft = ( winW  / 2 )- ( w  / 2 )
  owin.style.left        = nleft + 'px';
  
  field_to_focus.focus();   
	
}	

function message_popup(msg,w,h,hdr)

{


      
      
       var owin    = document.getElementById("MMS_PopWindow");
	var owin_msg = document.getElementById("MMS_PopWindow_alertmsg");
	var owin_hdr = document.getElementById("MMS_PopWindow_header");
	var field_to_focus = document.getElementById("cursor_beacon");
	
	
	if ( typeof(hdr) == "undefined" )
	   {
	   var hdr="";
	   }
	  
	owin.style.visibility    = "visible";
	owin_msg.style.fontSize  = "13px";
	owin_msg.style.textalign = "center";
	owin_msg.innerHTML       = msg;
	owin_hdr.innerHTML       = hdr;
	owin_msg.height          =  h + 'px';
	owin.style.width         = w + 'px';
	owin.style.height        = h + 'px';	
	
	
  
 
  
  
  if ( checkIE('IE') )
     {
     var IpopTop = (document.documentElement.clientHeight- h)/2;
     var IpopLeft = (document.documentElement.clientWidth - w)/2;      
  
     owin.style.left=(IpopLeft + document.documentElement.scrollLeft) + 'px' ;
     owin.style.top=(IpopTop + document.documentElement.scrollTop) + 'px' ;
          
     }
  else
     {
     var IpopTop = (window.innerHeight - h)/2;
     var IpopLeft = (window.innerWidth - w)/2;
     
     owin.style.left=(IpopLeft + window.pageXOffset) + 'px' ;
     owin.style.top=(IpopTop + window.pageYOffset) + 'px' ;  
     }   
     
  
      
}      

function profile_popup(url)
{
window.open(url, 'ProfilePopUp', 'top=10,left=10,width=650, height=660, menubar=no, status=no, resizable=no, scrollbars=no, toolbar=no, location=no');
}

var profile_popup_ajax_XmlHttpObj;

function profile_popup_ajax_CreateXmlHttpObj()
    {
     	// try creating for IE (note: we don't know the user's browser type here, just attempting IE first.)
	   try
	    {
		   profile_popup_ajax_XmlHttpObj = new ActiveXObject("Msxml2.XMLHTTP");
	    }
	   catch(e)
	   {
		   try
		    {
			  profile_popup_ajax_XmlHttpObj = new ActiveXObject("Microsoft.XMLHTTP");
		    } 
		    catch(oc)
	     	{
			  profile_popup_ajax_XmlHttpObj = null;
		    }  
	    }
	   // if unable to create using IE specific code then try creating for Mozilla (FireFox) 
  	 if(!profile_popup_ajax_XmlHttpObj && typeof XMLHttpRequest != "undefined") 
	   {
		  profile_popup_ajax_XmlHttpObj = new XMLHttpRequest();
	   }
    }
    
function profile_popup_ajax(url)
{

var requestUrl;
    
    var s = current_date_txt();
    requestUrl = url  + '&date='+ s;
    
	  profile_popup_ajax_CreateXmlHttpObj();
	  
	  	
	 if(profile_popup_ajax_XmlHttpObj)
	   {
		 profile_popup_ajax_XmlHttpObj.onreadystatechange = profile_popup_ajax_get_result;
		 profile_popup_ajax_XmlHttpObj.open("GET", requestUrl,  true);		
		 profile_popup_ajax_XmlHttpObj.send(null);		
	   } 
}

function profile_popup_ajax_get_result() {	
  
	if ( profile_popup_ajax_XmlHttpObj.readyState == 4 )
	   {
	     if( profile_popup_ajax_XmlHttpObj.status == 200 )
	      {	      	      
	      var response =  profile_popup_ajax_XmlHttpObj.responseText;
	      
	       var owin    = document.getElementById("MMS_PopWindow");
	       //owin.zIndex="70";
	       var oshadow    = document.getElementById("MMS_shadow");
	       owin.style.top ="10px";
         message_box_center(response,650,660);        
         profile_popup_ajax_effect_content_popup();
         
         oshadow.className="MMS_shadow_show";
        
        
        
        var oPopWindow_header    = document.getElementById("MMS_PopWindow_header");
        
        oPopWindow_header.innerHTML='<span style="color:#ffffff;font-weight:bold">Profile Preview</span>';          
        }    
     }   
	 	 
  }
  

function  profile_popup_ajax_changeOpac(opacity, id) {
var object = document.getElementById(id).style;
object.opacity = (opacity / 100);
object.MozOpacity = (opacity / 100);
object.KhtmlOpacity = (opacity / 100);
object.filter = "alpha(opacity=" + opacity + ")";
}
function  profile_popup_ajax_effect_content_popup() {
var speed = Math.round(1000 / 100);
var timer = 0;
for(i = 0; i <= 100; i++) {
setTimeout("profile_popup_ajax_changeOpac(" + i + ",'content_popup')",(timer * speed));
//setTimeout("opf_changeOpac(" + i + ",'mainpic')",(timer * speed));
timer++;
}
}



var profile_photo300_XmlHttpObj;

function profile_photo300_CreateXmlHttpObj()
    {
     	// try creating for IE (note: we don't know the user's browser type here, just attempting IE first.)
	   try
	    {
		   profile_photo300_XmlHttpObj = new ActiveXObject("Msxml2.XMLHTTP");
	    }
	   catch(e)
	   {
		   try
		    {
			  profile_photo300_XmlHttpObj = new ActiveXObject("Microsoft.XMLHTTP");
		    } 
		    catch(oc)
	     	{
			  profile_photo300_XmlHttpObj = null;
		    }  
	    }
	   // if unable to create using IE specific code then try creating for Mozilla (FireFox) 
  	 if(!profile_photo300_XmlHttpObj && typeof XMLHttpRequest != "undefined") 
	   {
		  profile_photo300_XmlHttpObj = new XMLHttpRequest();
	   }
    }
    
function profile_popup_photo300(url)
{

var requestUrl;
    
    var s = current_date_txt();
    requestUrl = url  + '&date='+ s;
    
	  profile_photo300_CreateXmlHttpObj();
	  
	  	
	 if(profile_photo300_XmlHttpObj)
	   {
	    
		 profile_photo300_XmlHttpObj.onreadystatechange = profile_popup_photo300_get_result;
		 profile_photo300_XmlHttpObj.open("GET", requestUrl,  true);		
		 profile_photo300_XmlHttpObj.send(null);		
	   } 
}

function profile_popup_photo300_get_result() {	
  
	if ( profile_photo300_XmlHttpObj.readyState == 4 )
	   {
	     if( profile_photo300_XmlHttpObj.status == 200 )
	      {	      	      
	      var response =  profile_photo300_XmlHttpObj.responseText;
	      
	      
        var thumbnail_ajax   = document.getElementById("thumbnail_ajax");
        thumbnail_ajax.innerHTML=response;                    
        }    
     }   
	 	 
  }


function phone_number_check()
{
var c     = document.getElementById("c_code").value;
var a     = document.getElementById("a_code").value;
var phone = document.getElementById("phonenumber").value;

var c_m     =/.\d{2}/
var a_m     =/\d{3}/
var phone_m =/\d{7}/

if ( !c_m.test(c) )
   {
   alert('ERROR! Invalid Country Code.' );
   return false;
   }
if ( !a_m.test(a) || a.length != 3 )
   {
   alert('ERROR! Invalid Area Code.' );
   return false;
   }   
   
if ( !phone_m.test(phone) || phone.length != 7 )
   {
   alert('ERROR! Invalid Phone number.' );
   return false;
   }
   
      
return true;   
}  


function SelectStaff()
{
 var staff = document.getElementById("staff").value;
 setcookie("rs_staff_ID",staff,0);
}

// fix ie select cut off
function FixWidth(selectObj)
{
var newSelectObj = document.createElement("select");
newSelectObj = selectObj.cloneNode(true);
newSelectObj.selectedIndex = selectObj.selectedIndex;
newSelectObj.onmouseover = null;

var e = selectObj;
var absTop = e.offsetTop;
var absLeft = e.offsetLeft;
while(e = e.offsetParent)
{
absTop += e.offsetTop;
absLeft += e.offsetLeft;
}
with (newSelectObj.style)
{
position = "absolute";
top = absTop + "px";
left = absLeft + "px";
width = "";
}

var rollback = function(){ RollbackWidth(selectObj, newSelectObj); };
newSelectObj.focus();
newSelectObj.onblur = rollback;
newSelectObj.onchange = rollback;

selectObj.style.visibility = "hidden";
document.body.appendChild(newSelectObj);
}

function RollbackWidth(selectObj, newSelectObj)
{
selectObj.selectedIndex = newSelectObj.selectedIndex;
selectObj.style.visibility = "visible";
document.body.removeChild(newSelectObj);
}

///////////////////////////////////////////////////
