function GetXmlHttpObject1()
{

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;
}

var imgWidth=0;
var imgHeight=0;

function changePerformerImage(imgpath)
{
imgWidth=250;
imgHeight=150;
//alert(imgpath);
//document.getElementById('imgProfile').src=imgpath;
document.getElementById('hiddenimage').value=imgpath;
var mainurl=document.getElementById('mainurl').value;
//alert(mainurl);
showimage(mainurl,'med');
//alert(mainurl+'?s=visitor.fullScreenImage');

a=actualheight;
b=document.getElementById('centermainimage').offsetHeight;

//alert(b);
//i=56.5;
i=60;
//alert(a);

z=parseInt((a-(b+30))/i); 



z=z+1;
e=b+30+z*i;

if(b>a)
{
e=b+30;
}

//alert(e);
document.getElementById('information').style.height=e+"px";

	

}



function changePerformerImageMinisite(imgpath)
{
document.getElementById('hiddenimage').value=imgpath;
var mainurl=document.getElementById('mainurl').value;
showimage(mainurl,'med');
}



function showimage(location,type)
{

		var path=document.getElementById('hiddenimage').value;
		
		

		
		
		if(type=='large')
		{
		var totalpath=path.replace('66x66','1024x768');
		var url=location+"?picpath="+totalpath;
		display(location,totalpath);
		}
		else if(type=='med')
		{
			var totalpath=path.replace('66x66','250x150');
			document.getElementById('imgProfile').src=totalpath;	
		}


}


var win = null;
function NewWindow(mypage,myname,w,h,scroll)
{
LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
settings =
'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',resizable'
win = window.open(mypage,settings)
}



  function searchPerformer(searcheditem)
  {
  	var a=document.catForm.catSubCat.value;
	var catid=document.getElementById('catId').value;
	var path=document.getElementById('mainurl').value; 
	
	if(a=='')
	{
		//document.location.href="allPerformer.php?catId="+document.catForm.catSubCat.value+"&subCatId=-1"+"&search="+searcheditem;
		document.location.href=path+"&catId="+catid+"&subCatId="+'-1'+"&search="+searcheditem;
	}
	else
	{
		//document.location.href="allPerformer.php?catId="+a[0]+"&subCatId="+a[1]+"&search="+searcheditem;
		//alert("subcat=====  "+a);
		document.location.href=path+"&catId="+catid+"&subCatId="+a+"&search="+searcheditem;
	}
  }
  
  //Encode Function
  var keyStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" + "abcdefghijklmnopqrstuvwxyz" + "0123456789+/="; 
  function base64_encode(inp)
{
var out = ""; //This is the output
var chr1, chr2, chr3 = ""; //These are the 3 bytes to be encoded
var enc1, enc2, enc3, enc4 = ""; //These are the 4 encoded bytes
var i = 0; //Position counter
do { //Set up the loop here
chr1 = inp.charCodeAt(i++); //Grab the first byte
chr2 = inp.charCodeAt(i++); //Grab the second byte
chr3 = inp.charCodeAt(i++); //Grab the third byte
//Here is the actual base64 encode part.
//There really is only one way to do it.
enc1 = chr1 >> 2;
enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);
enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);
enc4 = chr3 & 63;

if (isNaN(chr2)) {
enc3 = enc4 = 64;
} else if (isNaN(chr3)) {
enc4 = 64;
}
//Lets spit out the 4 encoded bytes
out = out + keyStr.charAt(enc1) + keyStr.charAt(enc2) + keyStr.charAt(enc3) +
keyStr.charAt(enc4);
// OK, now clean out the variables used.
chr1 = chr2 = chr3 = "";
enc1 = enc2 = enc3 = enc4 = "";
} while (i < inp.length); //And finish off the loop
//Now return the encoded values.
return out;
}

/*function showFullImage(imgpath)
{
//document.getElementById('imgProfile').src=imgpath;

window.open();
}*/


function display(location,totalpath)
{
var xmlHttpfunction;

xmlHttp=GetXmlHttpObject1()
if (xmlHttp==null)
 {
 alert ("Browser does not support HTTP Request")
 return
 }
var urlparam=location+"&picpath="+totalpath+"&param=1";
var url=location+"&picpath="+totalpath;
xmlHttp.onreadystatechange=stateChanged 
xmlHttp.open("GET",urlparam,true)
xmlHttp.send(null)

//alert(urlparam);
function stateChanged() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 
 var responsearray=xmlHttp.responseText;
//alert(responsearray);
var arrayvalues=responsearray.split('/');

var width=parseInt(arrayvalues[0])+30+"px";
//alert(width);
var height=parseInt(arrayvalues[1])+40+"px";
//alert(height);

		if(screen.width==1024)
		{
		window.open(url,"newWindow",'alwaysRaised=yes,scrollbars=1,resizable=yes,height='+height+',width='+width)
		}
		else if(screen.width==1280)
		{
		window.open(url,"newWindow",'alwaysRaised=yes,scrollbars=1,resizable=yes,height='+height+',width='+width)
		}
		else if(screen.width==1400)
		{
		window.open(url,"newWindow",'alwaysRaised=yes,scrollbars=1,resizable=yes,height='+height+',width='+width)
		}
		else
		{
		window.open(url,"newWindow",'alwaysRaised=yes,scrollbars=1,resizable=yes,height='+height+',width='+width)
		}
 } 
}
}
 


function disableLinkForPrivate()
{
	//document.getElementById('spanprivatelinkfreechat').innerHTML="";
}

function enableLinkForPrivate()
{
	//document.getElementById('spanprivatelinkfreechat').style.visibility="visible";
}

function miniPopup(location,path)
{

var totalpath=path.replace('66x66','1024x768');
		//var url=location+"&picpath="+totalpath;
		//window.open(url,"_blank",'scrollbars=yes,resizable=yes,height='+(768+40)+',width='+(1024+30))
		display(location,totalpath);
}


function setEqualHeightMinisite()
{
	//alert("right=="+document.getElementById('modelsright').offsetHeight);	
	//alert("left=="+document.getElementById('leftcontent').offsetHeight);
	
	if(document.getElementById('showArchieveDivTag')!=null)
	{
		if(document.getElementById('userFavoritesModels')!=null)
		{
			var rightDivHeight=parseInt(document.getElementById('onlineModelList').offsetHeight+document.getElementById('myShowArchieves').offsetHeight+document.getElementById('userFavoritesModels').offsetHeight+document.getElementById('flingPromoDiv').offsetHeight);
		}
		else
		{
			var rightDivHeight=parseInt(document.getElementById('onlineModelList').offsetHeight+document.getElementById('myShowArchieves').offsetHeight+document.getElementById('flingPromoDiv').offsetHeight);			
		}
			
		var leftDivHeight=document.getElementById('leftcontent').offsetHeight;

		if(rightDivHeight>leftDivHeight)
		{			
			var heightLeft=parseInt(rightDivHeight-10);
			document.getElementById('leftnextcontent').style.height=heightLeft+"px";		
		}
		else
		{
			var heightRight=parseInt(leftDivHeight-rightDivHeight);
			var heightRightMain=parseInt(document.getElementById('showArchieveDivTag').offsetHeight+heightRight);
			var heightRightActualMain=parseInt(heightRightMain-25);			
			document.getElementById('showArchieveDivTag').style.height=heightRightActualMain+"px";
		}
	}
	else
	{
		if(document.getElementById('userFavoritesModels')!=null)
		{
			var leftDivHeight=document.getElementById('leftcontent').offsetHeight;
			var rightDivHeight=parseInt(document.getElementById('onlineModelList').offsetHeight+document.getElementById('userFavoritesModels').offsetHeight+document.getElementById('flingPromoDiv').offsetHeight);
	
			if(rightDivHeight>leftDivHeight)
			{
				var heightLeft=parseInt(rightDivHeight-12);
				document.getElementById('leftnextcontent').style.height=heightLeft+"px";		
			}
		}
	}

}


function setFreeChatEqualHeight()
{
	//alert("right=="+document.getElementById('modelsright').offsetHeight);	
	//alert("left=="+document.getElementById('leftcontent').offsetHeight);

		if(document.getElementById('userFavoritesModels')!=null)
		{
			var leftDivHeight=document.getElementById('leftnextcontent').offsetHeight;
			var rightDivHeight=parseInt(document.getElementById('userFavoritesModels').offsetHeight+document.getElementById('modelsright').offsetHeight);
			
			if(rightDivHeight>leftDivHeight)
			{			
				var heightLeft=parseInt(rightDivHeight);
				document.getElementById('leftnextcontent').style.height=heightLeft+"px";		
			}
		}

}
