function openNewWindow(newWindowURL)
{
	// Forces the current window to remain on top
	//window.open(newWindowURL,'').blur();
	//window.focus();
}

function setAllModelsCount()
{
	document.getElementById('categoryCountDiv').innerHTML="("+document.getElementById('AllModelsCountValue').value+")";
}

function setAllModelsCountNew()
{
	if(document.getElementById('categoryCountDiv'))
    {
        document.getElementById('categoryCountDiv').innerHTML="("+document.getElementById('AllModelsCountValue').value+")";
    }
    
	if(document.getElementById('categoryTextCount'))
    {
        document.getElementById('categoryTextCount').innerHTML="("+document.getElementById('AllModelsCountValue').value+")";	
    }
}


function onMouseHoverCat(divId)
{
document.getElementById(divId).className="subCatOnMouseOver";
}


function onMouseOutCat(divId)
{
document.getElementById(divId).className="subCatOnMouseOut";
}



function arrowOver(divId)
{
document.getElementById(divId).className="shapeOver";
}


function arrowOut(divId)
{
document.getElementById(divId).className="shapeOut";
}


function displaySubCategoryBlock()
{
document.getElementById('subCategoryBoxLayer').style.display="block";
}

function hideSubCategoryBlock()
{
document.getElementById('subCategoryBoxLayer').style.display="none";
}

function setTabWidth(divId,source,whitelabel)
{
var width=parseInt(document.getElementById(source).offsetWidth+10);	 
var labelwidth=parseInt(document.getElementById(source).offsetWidth+8);	
document.getElementById(divId).style.width=width+"px"; 	
document.getElementById(whitelabel).style.width=labelwidth+"px"; 	
}

function setTabWidthNew(divId,source,whitelabel)
{
var width=0;	
var labelwidth=0;
if(document.getElementById(source))
{
	var width=parseInt(document.getElementById(source).offsetWidth+10);
	var labelwidth=parseInt(document.getElementById(source).offsetWidth+8);	
}


if(document.getElementById(divId))
{
	document.getElementById(divId).style.width=width+"px"; 	
}

if(document.getElementById(whitelabel))
{
	document.getElementById(whitelabel).style.width=labelwidth+"px"; 	
}

	if(divId=="liveGirlsTab")
	{
	var catwidth=parseInt(document.getElementById("categoryText").offsetWidth);	
	document.getElementById("liveGirlsTab").style.width=catwidth+"px";
	var catLabel=parseInt(catwidth-2);
	document.getElementById("girlsWhiteLabel").style.width=catLabel+"px"; 			
	}

}

function goThere(value){
	var linkList=value
	if(linkList!=""){document.location.href=linkList;}
}


function displayRandomOption()
{
	document.getElementById('randomMainDiv').style.display="block";	
}

function setDivBackground(id)
{
	document.getElementById(id).style.background="#EEEEEE";	
}

function unsetDivBackground(id)
{
	document.getElementById(id).style.background="#ffffff";	
}

function hideRandomOption()
{
		document.getElementById('randomMainDiv').style.display="none";			
}



function getConfirmationObjects()
{
	var margin=parseInt(document.body.clientWidth-960);
	var leftmargin=parseInt(margin/2);
	this.margin=margin;
	this.leftmargin=leftmargin;
	this.bodywidth=document.body.clientWidth;
	return this;
}

function setConfirmationLayer()
{
	var objConfirmation=getConfirmationObjects();
	var middleString=document.getElementById('displayString').value;
	var string="<div id='emailConfirmationOverlay' style='width:"+objConfirmation.bodywidth+"px; margin-left:-"+objConfirmation.leftmargin+"px'>"+middleString+"</div>";
	document.getElementById("emailConfirmationLayer").innerHTML=string;
	//$("#emailConfirmationLayer").html(string); 
}

function confirmEmail()
{	
	/*
    document.getElementById('confirmYourEmail').style.display="none";
    document.getElementById('confirmErrorBlock').style.display="none";
    document.getElementById('confirmWaitBlock').style.display="block";
    */
	
	var objConfirmation=getConfirmationObjects();
	var middleString=document.getElementById('confirmWaitBlock').value;	
	var string="<div id='emailConfirmationOverlay' style='width:"+objConfirmation.bodywidth+"px; margin-left:-"+objConfirmation.leftmargin+"px'>"+middleString+"</div>";	
	document.getElementById("emailConfirmationLayer").innerHTML=string;
	
    var url =document.getElementById('hidConfirmEmailPage').value;
    if(url.indexOf('?') != -1)
    {
        url=url+"&pixelVarFlag=1";
    } else {
        url=url+"?pixelVarFlag=1";
    }
    
    var pars = '';    
    /*var myAjax = new Ajax.Request
    (
        url, 
        {
            method:'get', 
            parameters: pars, 
            onComplete: showConfirmEmailResponse      
        }
    );*/
    
    
   var f = function() {
            $.get(url,
            function(data) {
                var objConfirmation=getConfirmationObjects();
                if(data=="success")
                {
                    var middleString=document.getElementById('confirmEmailSent').value;        
                    var string="<div id='emailConfirmationOverlay' style='width:"+objConfirmation.bodywidth+"px; margin-left:-"+objConfirmation.leftmargin+"px'>"+middleString+"</div>";            
                    document.getElementById("emailConfirmationLayer").innerHTML=string;
                }else
                {
                    var middleString=document.getElementById('confirmErrorBlock').value;        
                    var string="<div id='emailConfirmationOverlay' style='width:"+objConfirmation.bodywidth+"px; margin-left:-"+objConfirmation.leftmargin+"px'>"+middleString+"</div>";            
                    document.getElementById("emailConfirmationLayer").innerHTML=string;    
                            //document.getElementById('confirmErrorBlock').style.display="block"; 
                }},
            "html")};        
    
   setTimeout(f,600);
    

}

function showConfirmEmailResponse(originalRequest)
{
	var objConfirmation=getConfirmationObjects();
    var response=originalRequest.responseText;
    //document.getElementById('confirmWaitBlock').style.display="none"; 
	
	if(response=="success")
	{
	//document.getElementById("successFlag").value=parseInt(document.getElementById("successFlag").value+1);
	var middleString=document.getElementById('confirmEmailSent').value;		
	var string="<div id='emailConfirmationOverlay' style='width:"+objConfirmation.bodywidth+"px; margin-left:-"+objConfirmation.leftmargin+"px'>"+middleString+"</div>";			
	document.getElementById("emailConfirmationLayer").innerHTML=string;		
			//document.getElementById('confirmEmailSent').style.display="block";
		
		//var successFlag=parseInt(document.getElementById("successFlag").value);
		//setTimeout("hideConfirmationDiv()", 2000);
	}
	else
	{
	var middleString=document.getElementById('confirmErrorBlock').value;		
	var string="<div id='emailConfirmationOverlay' style='width:"+objConfirmation.bodywidth+"px; margin-left:-"+objConfirmation.leftmargin+"px'>"+middleString+"</div>";			
	document.getElementById("emailConfirmationLayer").innerHTML=string;	
			//document.getElementById('confirmErrorBlock').style.display="block"; 
	}

}


function hideConfirmationDiv()
{
	document.getElementById("emailConfirmationMain").style.display="none";	
}

function preventPrivate(isDisable)
{
	//alert(isDisable);
	if(document.getElementById('beforeFreechatulinktext')){
		if(isDisable==true)
			document.getElementById("beforeFreechatulinktext").style.display="block";
		else
			document.getElementById("beforeFreechatulinktext").style.display="none";
	}
}

function preventPrivateShow(isDisable)
{
    //alert(isDisable);
    if(document.getElementById('beforeFreechatulinktext')){
        if(isDisable!=true)
            document.getElementById("beforeFreechatulinktext").style.display="block";
        else
            document.getElementById("beforeFreechatulinktext").style.display="none";
    }
}

function updateDropdownTitle(subcatName, catName, lk){
    setPageCookie("nkCookie[catName]", catName, 0, '/', '', '' );
    setPageCookie("nkCookie[subcatName]", subcatName, 0, '/', '', '' );
    var t = $(lk), ajaxPath = t.attr('href');
    document.location.href = ajaxPath;
}

function redirectionWithCategory(lk, catName)
{
    setPageCookie("nkCookie[catName]", catName, 0, '/', '', '' );
    setPageCookie("nkCookie[subcatName]", 'all', 0, '/', '', '' );
    var t = $(lk), ajaxPath = t.attr('href');
    document.location.href = ajaxPath;
}

function setPageCookie( name, value, expires, path, domain, secure )
{
var today = new Date();
today.setTime( today.getTime() );
if ( expires )
{
expires = expires * 1000 * 60 * 60 * 24;
}
var expires_date = new Date( today.getTime() + (expires) );

document.cookie = name + "=" +escape( value ) +
( ( expires ) ? ";expires=" + expires_date.toGMTString() : "" ) +
( ( path ) ? ";path=" + path : "" ) +
( ( domain ) ? ";domain=" + domain : "" ) +
( ( secure ) ? ";secure" : "" );
}

if (typeof jQuery == 'undefined') {
if($(document).ready  !=  undefined) {

        $(document).ready(function(){
            $(".btn-slide").click(function(){
                    $("#panel").toggle();
                    $(this).toggleClass("act"); return false;
            });

            $("#panel a").click(function(){
                    $("#panel").hide();
                    $(".btn-slide").toggleClass("act"); return false;
            });
    });
    }

} else {
jQuery(document).ready(function(){
	jQuery(".btn-slide").click(function(){
		jQuery("#panel").toggle();
		jQuery(this).toggleClass("act"); return false;
	});

	jQuery("#panel a").click(function(){
		jQuery("#panel").hide();
		jQuery(".btn-slide").toggleClass("act"); return false;
	});
});

}

