var disappeardelay1=2500  //menu disappear speed onMouseout (in miliseconds)
var initialwidthcopy1,initialheightcopy1
var ie5=document.all&&document.getElementById
var ns6=document.getElementById&&!document.all
var conformuser = "";
var ns4=document.layers?1:0
var ie4=document.all?1:0
var ns6=document.getElementById&&!document.all?1:0
function iecompattest()
{
	return (!window.opera && document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}
function loadwindow(width,height,username,iuserid)
{
	
	if (!ie5&&!ns6)
		window.open(url,"","width=width,height=height,scrollbars=1")
	else
	{
		document.getElementById("dwindow1").style.display=''
		//document.getElementById("dwindow").style.width=initialwidthcopy=width+"px"
		//document.getElementById("dwindow").style.height=initialheightcopy=height+"px"
		document.getElementById("dwindow1").style.top=350+"px" //i*72+18+"px"
		document.getElementById("username").innerHTML=username;
		document.getElementById("iuserid").innerText=iuserid;
		conformuser = username;
		
	}
}

function loadwindow_profile(width,height,username,iuserid)
{
	if (!ie5&&!ns6)
		window.open(url,"","width=width,height=height,scrollbars=1")
	else
	{
		document.getElementById("dwindow1").style.display='inline';
		//document.getElementById("dwindow").style.width=initialwidthcopy=width+"px"
		//document.getElementById("dwindow").style.height=initialheightcopy=height+"px"
		document.getElementById("username").innerHTML=username;
		document.getElementById("iuserid").innerHTML=iuserid;
		document.getElementById("dwindow1").style.left=50+"px";
		var conformuser = username;
	}
}

function loadwindowConformOk_profile(width,height)
{
	//document.getElementById("dwindow1").style.display="none";
	if (!ie5&&!ns6)
		window.open(url,"","width=width,height=height,scrollbars=1")
	else
	{
		document.getElementById("dwindow1").style.display='none';
		document.getElementById("loadwindowConformOk").style.display='';
		//document.getElementById("dwindow").style.width=initialwidthcopy=width+"px"
		//document.getElementById("loadwindowConformOk").style.height=100+"px"
		document.getElementById("loadwindowConformOk").style.left=50+"px";
		document.getElementById("loadwindowConformOk").style.top=event.clientY; //i*72+18+"px"
		document.getElementById("conformuser").innerHTML=document.getElementById('username').innerHTML;
		//document.getElementById("iuserid").innerText=iuserid;
		
	}
}

function loadwindowConformOk(width,height)
{
	
	if (!ie5&&!ns6)
		window.open(url,"","width=width,height=height,scrollbars=1")
	else
	{
		document.getElementById("loadwindowConformOk").style.display=''
		//document.getElementById("dwindow").style.width=initialwidthcopy=width+"px"
		//document.getElementById("dwindow").style.height=initialheightcopy=height+"px"
		document.getElementById("loadwindowConformOk").style.top=350+"px" //i*72+18+"px"
		document.getElementById("conformuser").innerHTML=conformuser;
		//document.getElementById("iuserid").innerText=iuserid;
		
	}
}
function closesent()
{
	document.getElementById('loadwindowConformOk').style.display = 'none';
}
function close11()	
{
	document.getElementById("dwindow1").style.display="none"
}

function closeConformOk()	
{
	document.getElementById("loadwindowConformOk").style.display="none"
}
function loadposition_captcha()
{
	var evt = window.event || arguments.callee.caller.arguments[0];
	document.getElementById('dhtmlwin_captcha').style.display = 'none';

	if (ie4) {
		document.getElementById("dhtmlwin_captcha").style.pixelTop=document.body.scrollTop+evt.clientY-50;
		document.getElementById("dhtmlwin_captcha").style.pixelLeft=document.body.scrollLeft+evt.clientX-140;
	}
	else if (ns6) {
		document.getElementById("dhtmlwin_captcha").style.top=window.pageYOffset+evt.clientY-50;
		document.getElementById("dhtmlwin_captcha").style.left=evt.clientX-140;
	}
}
function addfuddy()
{
	//alert("Session userid---"+sessionuserid+"\nadduser"+document.getElementById("iuserid").innerText);
	
	var BuddyAddObject ;
	try
	{	
		BuddyAddObject = new XMLHttpRequest();
	}catch(e)
	{
		try
		{
			BuddyAddObject = new ActiveXObject("Msxml2.XMLHTTP");	
			
		}
		catch (e)
		{
			try
			{
				BuddyAddObject = new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch (e)
			{
				alert('Not Supporting in ie');
				return false;
			}
		}
	}
	document.getElementById('wrongcaptcha').style.display="none";
    if(document.getElementById('dhtmlwin_captcha').style.display=='inline' && trim(document.getElementById('security_code_addbuddy').value) == "")
	{
		alert("Please enter the code shown in image");
		document.getElementById('security_code_addbuddy').focus();
		return false;
	}
	else if(document.getElementById('dhtmlwin_captcha').style.display=='none')
	{
		document.getElementById('dhtmlwin_captcha').style.display='inline';
		document.getElementById('dwindow1').style.display='none';
		return false;
	}
	BuddyAddObject.onreadystatechange = function(){

		if(BuddyAddObject.readyState == 4)
		{
			//alert('response....'+BuddyAddObject.responseText);
			if(trim(BuddyAddObject.responseText) == "captchafail")
			{
				document.getElementById('iframe2').src='Oscaptcha/captcha_sample_AB.php';
				document.getElementById('submitCaptcha_addbuddy').disabled=false;
				document.getElementById('wrongcaptcha').style.display="inline";
				document.getElementById('security_code_addbuddy').value="";
				document.getElementById('security_code_addbuddy').focus();
			}
		    else
			{
				document.getElementById('iframe2').src='Oscaptcha/captcha_sample_AB.php';
				document.getElementById('captcha_id1').style.display="none";
				document.getElementById('loadwindowConformOk1').style.display="inline";
				document.getElementById('addmeSpan').style.display="none";
			}
					
		}
	}
		
		var adduserid = document.getElementById("iuserid").innerHTML
		
		var url="AddBuddylistUser.php";
		url=url+"?adduserid="+adduserid+"&captchavalue="+document.getElementById('security_code_addbuddy').value;
		//alert('url....'+url);
        //alert(url);
		BuddyAddObject.open("GET", url, true);
		BuddyAddObject.send(null); 
}
