var xmlHttp ;
function GetXmlHttpObject()
{ 
	var objXMLHttp=null
	if (window.XMLHttpRequest)
	{
		objXMLHttp=new XMLHttpRequest()
	}
	else if (window.ActiveXObject)
	{
		objXMLHttp=new ActiveXObject("Microsoft.XMLHTTP")
	}
	return objXMLHttp
}

function showRegisterBox()
{
		document.getElementById("rightcontainerholder").innerHTML = "<table width=\"100%\" border=\"0\" height=\"250\"><tr><td class=\"gap10\">&nbsp;</td></tr><tr><td class=\"gap10\">&nbsp;</td></tr><tr><td valign=\"middle\" align=\"center\"><img src=\"images/loader.gif\" border=0></td></tr></table>";
		var url="function.php?getRegBox=yes"
		url=url+"&sid="+Math.random()
		xmlHttp=GetXmlHttpObject()
		if (xmlHttp==null)
		{
			alert ("Browser does not support HTTP Request")
			return
		} 
		xmlHttp.onreadystatechange=onshowRegisterBox
		xmlHttp.open("GET",url,true) 
		xmlHttp.send(null) 
}

function onshowRegisterBox()
{
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"	)
	{
		if(xmlHttp.responseText != '')
		{
			document.getElementById("rightcontainerholder").innerHTML = xmlHttp.responseText 
		}
	}
}
	
function clearQ()
{
	$('#fileInput2').fileUploadClearQueue();
}

function startUpload()
{
	$('#fileInput2').fileUploadStart();
}
	
function showUploadPhoto()
{
	var gender=document.getElementById('gender1').value;
	var age=document.getElementById('age1').value;
	var name=document.getElementById('name').value;
	var email=document.getElementById('email').value;
	var country=document.getElementById('country').value;
	var state=document.getElementById('state').value;
	var city=document.getElementById('city').value;
	var zip=document.getElementById('zip').value;
	var nterest=document.getElementById('nterest').value;
	var password=document.getElementById('password').value;
	
	if(age==-1)
	{
		displayerror(4,'age1');
		//alert('Please select the age');
		return false;
	}
	
	if(name=="")
	{
		displayerror(5,'name');
		//alert('Please enter the your name');
		return false;
	}
	
	if(email=="")
	{
		displayerror(6,'email');
		//alert('Please enter your email-id.');
		return false;
	}
	
	if(password=="")
	{
		displayerror(3,'password');
		//alert('Please enter the password');
		return false;
	}
	
	if(country==-1)
	{
		displayerror(7,'country');
		//alert('Please select the country');
		return false;
	}
	
	if(state==-1)
	{
		displayerror(10,'state');
		//alert('Please select the country');
		return false;
	}
	
	if(city==-1)
	{
		displayerror(8,'city');
		//alert('Please select the city');
		return false;
	}
	
	if(nterest=="")
	{
		displayerror(9,'nterest');
		//alert('Please enter about your interest');
		return false;
	}
	

		var path="controller/profileRegister.php?uploadYes=yes&gender="+gender+"&age="+age+"&email="+email+"&country="+country+"&city="+city+"&zip="+zip+"&nterest="+nterest+"&password="+password+"&name="+name+"&state="+state;	
		var url=path;
		url=url+"&sid="+Math.random()
		xmlHttp=GetXmlHttpObject()
		if (xmlHttp==null)
		{
			alert ("Browser does not support HTTP Request")
			return
		} 
		xmlHttp.onreadystatechange=onshowUploadPhoto
		xmlHttp.open("GET",url,true) 
		xmlHttp.send(null) 
}

function onshowUploadPhoto()
{
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"	)
	{
		if(xmlHttp.responseText != '')
		{
			//location.href="index.php";
			var userids=xmlHttp.responseText;
			viewMyProfile3(userids);
		}
	}
}

function closeBox()
{
	$(document).trigger('close.facebox')
	return false
}

function showLoginBox()
{
		document.getElementById("boxlogin").innerHTML = "<table width=\"100%\" border=\"0\" height=\"150\"><tr><td class=\"gap10\">&nbsp;</td></tr><tr><td class=\"gap10\">&nbsp;</td></tr><tr><td valign=\"middle\" align=\"center\"><img src=\"images/loader.gif\" border=0></td></tr><tr><td class=\"gap10\">&nbsp;</td></tr><tr><td class=\"gap10\">&nbsp;</td></tr></table>";
		var url="function.php?getLoginBox=yes"
		url=url+"&sid="+Math.random()
		xmlHttp=GetXmlHttpObject()
		if (xmlHttp==null)
		{
			alert ("Browser does not support HTTP Request")
			return
		} 
		xmlHttp.onreadystatechange=onshowLoginBox
		xmlHttp.open("GET",url,true) 
		xmlHttp.send(null) 
}

function onshowLoginBox()
{
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"	)
	{
		if(xmlHttp.responseText != '')
		{
			document.getElementById("boxlogin").innerHTML = xmlHttp.responseText 
		}
	}
}

function login()
{
	var usernamelog=document.getElementById('usernamelog').value;
	var passwordlog=document.getElementById('passwordlog').value;
	
	if(usernamelog=="")
	{
		displayerror(2,'usernamelog');
		//document.getElementById('logerror').innerHTML="Please enter the username";
		//document.getElementById('usernamelog').focus();
		return false;
	}
	
	if(passwordlog=="")
	{
		displayerror(3,'passwordlog');
		//document.getElementById('logerror').innerHTML="Please enter the password";
		//document.getElementById('passwordlog').focus();
		return false;
	}
	
		document.getElementById("boxlogin").innerHTML = "<table width=\"100%\" border=\"0\" height=\"150\"><tr><td class=\"gap10\">&nbsp;</td></tr><tr><td class=\"gap10\">&nbsp;</td></tr><tr><td valign=\"middle\" align=\"center\"><img src=\"images/loader.gif\" border=0></td></tr><tr><td class=\"gap10\">&nbsp;</td></tr><tr><td class=\"gap10\">&nbsp;</td></tr></table>";
		var url="controller/login.php?login=yes&username="+usernamelog+"&password="+passwordlog
		url=url+"&sid="+Math.random()
		xmlHttp=GetXmlHttpObject()
		if (xmlHttp==null)
		{
			alert ("Browser does not support HTTP Request")
			return
		} 
		xmlHttp.onreadystatechange=onlogin
		xmlHttp.open("GET",url,true) 
		xmlHttp.send(null) 
}

function onlogin()
{
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"	)
	{
		if(xmlHttp.responseText != '')
		{
			var data=xmlHttp.responseText.split("~");
			if(data[0]=="error")
			{
				document.getElementById("boxlogin").innerHTML=data[1];
				document.getElementById('logerror').innerHTML="Invalid Username/Password.";
			}
			else
			{
/*				document.getElementById("boxlogin").innerHTML = xmlHttp.responseText 
				viewMyProfile2('');
*/				top.location.href="index.php?page=9";
			}
		}
	}
}

function findPassword()
{
	var emailid=document.getElementById('emailid').value;
	if(emailid=="")
	{
		document.getElementById('errort').innerHTML="Please enter your username (emailid).<br> ";
		return false;
	}
	
		
	document.getElementById("errort").innerHTML = "<center><img src=\"images/loader.gif\" border=0></center><br>";
	var url="controller/login.php?forgotlogin=yes&emailid="+emailid
	url=url+"&sid="+Math.random()
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	{
		alert ("Browser does not support HTTP Request")
		return
	} 
	xmlHttp.onreadystatechange=onfindPassword
	xmlHttp.open("GET",url,true) 
	xmlHttp.send(null) 
}

function onfindPassword()
{
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"	)
	{
		if(xmlHttp.responseText != '')
		{
			if(xmlHttp.responseText=="error")
			{
				document.getElementById("errort").innerHTML="This email-id does not exist.<br>";
			}
			else
			{
				document.getElementById("errort").innerHTML = "Username & Password sent to your email-id successfully.<br>";
			}
		}
	}
}

function showForgotBox(){
	jQuery.facebox({ ajax: "forgotpassword.php" });		
}

function showFacebox(page){
	jQuery.facebox({ ajax: page });		
}

function showEditProfileBox()
{
		document.getElementById("rightcontainerholder").innerHTML = "<table width=\"100%\" border=\"0\" height=\"250\"><tr><td class=\"gap10\">&nbsp;</td></tr><tr><td class=\"gap10\">&nbsp;</td></tr><tr><td valign=\"middle\" align=\"center\"><img src=\"images/loader.gif\" border=0></td></tr></table>";
		var url="function.php?getEditProfile=yes"
		url=url+"&sid="+Math.random()
		xmlHttp=GetXmlHttpObject()
		if (xmlHttp==null)
		{
			alert ("Browser does not support HTTP Request")
			return
		} 
		xmlHttp.onreadystatechange=onshowEditProfileBox
		xmlHttp.open("GET",url,true) 
		xmlHttp.send(null) 
}

function onshowEditProfileBox()
{
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"	)
	{
		if(xmlHttp.responseText != '')
		{
			document.getElementById("rightcontainerholder").innerHTML = xmlHttp.responseText 
		}
	}
}
	
function updateProfileData()
{
	var gender=document.getElementById('gender1').value;
	var age=document.getElementById('age1').value;
	var name=document.getElementById('name').value;
	var country=document.getElementById('country').value;
	var state=document.getElementById('state').value;
	var city=document.getElementById('city').value;
	var zip=document.getElementById('zip').value;
	var nterest=document.getElementById('nterest').value;
	var password=document.getElementById('password').value;
	var dd=document.getElementById('dd').value;
	var mm=document.getElementById('mm').value;
	var yy=document.getElementById('yyyy').value;
	
	if(age==-1)
	{
		displayerror(4,'age1');
		//alert('Please select the age');
		return false;
	}
	
	if(name=="")
	{
		displayerror(5,'name');
		//alert('Please enter the your name');
		return false;
	}
	
	if(password=="")
	{
		displayerror(3,'password');
		//alert('Please enter the password');
		return false;
	}
	
	if(dd==-1)
	{
		displayerror(11,'dd');
		//alert('Please select the country');
		return false;
	}
	
	if(mm==-1)
	{
		displayerror(11,'mm');
		//alert('Please select the country');
		return false;
	}

	if(yy==-1)
	{
		displayerror(11,'yyyy');
		//alert('Please select the country');
		return false;
	}
	
	if(country==-1)
	{
		displayerror(7,'country');
		//alert('Please select the country');
		return false;
	}
	
	if(state==-1)
	{
		displayerror(10,'state');
		//alert('Please select the country');
		return false;
	}
	
	if(city==-1)
	{
		displayerror(8,'city');
		//alert('Please select the city');
		return false;
	}
	
	if(nterest=="")
	{
		displayerror(9,'nterest');
		//alert('Please enter about your interest');
		return false;
	}
	

	var pathch="&gender="+gender+"&age="+age+"&country="+country+"&city="+city+"&zip="+zip+"&nterest="+nterest+"&password="+password+"&name="+name+"&state="+state+"&dd="+dd+"&mm="+mm+"&yy="+yy;
	var url="controller/profileRegister.php?updateProfile=yes"+pathch
	url=url+"&sid="+Math.random()
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	{
		alert ("Browser does not support HTTP Request")
		return
	} 
	xmlHttp.onreadystatechange=onupdateProfileData
	xmlHttp.open("GET",url,true) 
	xmlHttp.send(null) 
}

function onupdateProfileData()
{
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"	)
	{
		if(xmlHttp.responseText != '')
		{
			document.getElementById("errorprof").innerHTML = xmlHttp.responseText;
			viewMyProfile('');
		}
	}
}
	
function updateProfileImage(userid)
{
	showFacebox("uploadProfileImage.php?userid="+userid);
}

function showMyMails(pagenowithpath)
{
	var loading="<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" class=\"marginbottom5 fontbold\" height=\"500\"><tr><td valign=\"top\" align=\"left\" class=\"gap10\">&nbsp;</td></tr><tr><td valign=\"top\" align=\"left\" class=\"gap10\">&nbsp;</td></tr><tr><td valign=\"middle\" align=\"center\"><img src=\"images/loader.gif\" border=0></td></tr><tr><td valign=\"top\" align=\"left\" class=\"gap10\">&nbsp;</td></tr><tr><td valign=\"top\" align=\"left\" class=\"gap10\">&nbsp;</td></tr></table>";

	document.getElementById("middleconntent").innerHTML = loading; 
	
	var url=pagenowithpath;
	url=url+"&sid="+Math.random()
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	{
		alert ("Browser does not support HTTP Request")
		return
	} 
	xmlHttp.onreadystatechange=onshowMyMails
	xmlHttp.open("GET",url,true) 
	xmlHttp.send(null) 
}

function onshowMyMails()
{
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"	)
	{
		if(xmlHttp.responseText != '')
		{
			document.getElementById("middleconntent").innerHTML = xmlHttp.responseText 
		}
	}
}
	
function showMyMailsPage(pageno)
{
	var loading="<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" class=\"marginbottom5 fontbold\" height=\"500\"><tr><td valign=\"top\" align=\"left\" class=\"gap10\">&nbsp;</td></tr><tr><td valign=\"top\" align=\"left\" class=\"gap10\">&nbsp;</td></tr><tr><td valign=\"middle\" align=\"center\"><img src=\"images/loader.gif\" border=0></td></tr><tr><td valign=\"top\" align=\"left\" class=\"gap10\">&nbsp;</td></tr><tr><td valign=\"top\" align=\"left\" class=\"gap10\">&nbsp;</td></tr></table>";

	document.getElementById("middleconntent").innerHTML = loading; 
	
	var url="controller/profileRegister.php?showmails=yes&startlimit="+pageno
	url=url+"&sid="+Math.random()
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	{
		alert ("Browser does not support HTTP Request")
		return
	} 
	xmlHttp.onreadystatechange=onshowMyMailsPage
	xmlHttp.open("GET",url,true) 
	xmlHttp.send(null) 
}

function onshowMyMailsPage()
{
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"	)
	{
		if(xmlHttp.responseText != '')
		{
			document.getElementById("middleconntent").innerHTML = xmlHttp.responseText 
		}
	}
}
	
function showAlbum()
{
	document.getElementById("rightcontainerholder").innerHTML = "<table width=\"100%\" border=\"0\" height=\"250\"><tr><td class=\"gap10\">&nbsp;</td></tr><tr><td class=\"gap10\">&nbsp;</td></tr><tr><td valign=\"middle\" align=\"center\"><img src=\"images/loader.gif\" border=0></td></tr></table>";

	var url="controller/albums.php?getAlbumsOption=yes";
	url=url+"&sid="+Math.random()
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	{
		alert ("Browser does not support HTTP Request")
		return
	} 
	xmlHttp.onreadystatechange=onshowAlbum
	xmlHttp.open("GET",url,true) 
	xmlHttp.send(null) 
}

function onshowAlbum()
{
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"	)
	{
		if(xmlHttp.responseText != '')
		{
			document.getElementById("rightcontainerholder").innerHTML = xmlHttp.responseText ;
			showAlbumsList("controller/albums.php?showAlbumslist=yes&startlimit=0");
		}
	}
}
	
	
function createCollnew()
{
	document.getElementById("uploadoption").innerHTML = "<table width=\"100%\" border=\"0\" height=\"250\"><tr><td class=\"gap10\">&nbsp;</td></tr><tr><td class=\"gap10\">&nbsp;</td></tr><tr><td valign=\"middle\" align=\"center\"><img src=\"images/loader.gif\" border=0></td></tr></table>";

	var url="controller/albums.php?showAlbumCreate=yes";
	url=url+"&sid="+Math.random()
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	{
		alert ("Browser does not support HTTP Request")
		return
	} 
	xmlHttp.onreadystatechange=oncreateCollnew
	xmlHttp.open("GET",url,true) 
	xmlHttp.send(null) 
}

function oncreateCollnew()
{
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"	)
	{
		if(xmlHttp.responseText != '')
		{
			document.getElementById("uploadoption").innerHTML = xmlHttp.responseText 
		}
	}
}
	
function createAlbum()
{
		var newalbum=document.getElementById("newalbum").value;
		if(newalbum=="")
		{
			document.getElementById("errorphoto").innerHTML="Please enter the Collection name.";
			return false;
		}
		
		var privacy=document.getElementById("privacy").value;
		
		var url="controller/albums.php?setAlbum=yes&newalbum="+newalbum+"&privacy="+privacy
		url=url+"&sid="+Math.random()
		
		xmlHttp=GetXmlHttpObject()
		if (xmlHttp==null)
		{
			alert ("Browser does not support HTTP Request")
			return
		} 
		xmlHttp.onreadystatechange=onResultcreatedAlbum
		xmlHttp.open("GET",url,true) 
		xmlHttp.send(null) 
		
		
}

function onResultcreatedAlbum()
{
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"	)
	{
		if(xmlHttp.responseText != '')
		{
			document.getElementById("uploadoption").innerHTML = xmlHttp.responseText 
		}
	}
}

function setParams(userid)
{
	var collList=document.getElementById('collList').value;

	jQuery.facebox({ ajax: "uploadalbum.php?&collList="+collList+"&userid="+userid });
}

function showAlbumsOption()
{
	document.getElementById("uploadoption").innerHTML = "<table width=\"100%\" border=\"0\" height=\"250\"><tr><td class=\"gap10\">&nbsp;</td></tr><tr><td class=\"gap10\">&nbsp;</td></tr><tr><td valign=\"middle\" align=\"center\"><img src=\"images/loader.gif\" border=0></td></tr></table>";
		var url="controller/albums.php?showAlbumUpload=yes";
		url=url+"&sid="+Math.random()
		
		xmlHttp=GetXmlHttpObject()
		if (xmlHttp==null)
		{
			alert ("Browser does not support HTTP Request")
			return
		} 
		xmlHttp.onreadystatechange=onshowAlbumsOption
		xmlHttp.open("GET",url,true) 
		xmlHttp.send(null) 
		
		
}

function onshowAlbumsOption()
{
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"	)
	{
		if(xmlHttp.responseText != '')
		{
			document.getElementById("uploadoption").innerHTML = xmlHttp.responseText 
		}
	}
}

function selectAllBox(checkboxname)
{
	var checkbx="";
	var noofcheckboxes=document.getElementById('ucount').value;
	if(document.getElementById(checkboxname).checked)
	{
		for(var h=1;h<=noofcheckboxes;h++)
		{
			checkbx=checkboxname+h;
			document.getElementById(checkbx).checked= "checked";
		}
	}
	else
	{
		for(var h=1;h<=noofcheckboxes;h++)
		{
			checkbx=checkboxname+h;
			document.getElementById(checkbx).checked="";
		}
	}
}

function deleteSelected(checkboxname,controller)
{
	
	var checkbx="";
	var checkbxvalues="";
	var tempval="";
	var noofcheckboxes=document.getElementById('ucount').value;
	for(var h=1;h<=noofcheckboxes;h++)
	{
		checkbx=checkboxname+h;
		if(document.getElementById(checkbx).checked)
		{
			tempval=document.getElementById(checkbx).value;
			checkbxvalues=checkbxvalues+tempval+",";
		}
	}
		var url="controller/"+controller+"&deleteSelected=yes&deleteid="+checkbxvalues;
		url=url+"&sid="+Math.random()
		
		xmlHttp=GetXmlHttpObject()
		if (xmlHttp==null)
		{
			alert ("Browser does not support HTTP Request")
			return
		} 
		xmlHttp.onreadystatechange=ondeleteSelected
		xmlHttp.open("GET",url,true) 
		xmlHttp.send(null) 
		
		
}

function ondeleteSelected()
{
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"	)
	{
		if(xmlHttp.responseText != '')
		{
			var path="controller/profileRegister.php?showmails=yes&startlimit="+xmlHttp.responseText;
			showMyMails(path);
		}
	}
}

function showAlbumsList(pagenowithpath)
{
		var loading="<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" class=\"marginbottom5 fontbold\" height=\"500\"><tr><td valign=\"top\" align=\"left\" class=\"gap10\">&nbsp;</td></tr><tr><td valign=\"top\" align=\"left\" class=\"gap10\">&nbsp;</td></tr><tr><td valign=\"middle\" align=\"center\"><img src=\"images/loader.gif\" border=0></td></tr><tr><td valign=\"top\" align=\"left\" class=\"gap10\">&nbsp;</td></tr><tr><td valign=\"top\" align=\"left\" class=\"gap10\">&nbsp;</td></tr></table>";
		document.getElementById("albumcovers").innerHTML = loading; 
		
		var url=pagenowithpath;
		url=url+"&sid="+Math.random()
		xmlHttp=GetXmlHttpObject()
		if (xmlHttp==null)
		{
			alert ("Browser does not support HTTP Request")
			return
		} 
		xmlHttp.onreadystatechange=onshowAlbumsList
		xmlHttp.open("GET",url,true) 
		xmlHttp.send(null) 
}

function onshowAlbumsList()
{
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"	)
	{
		if(xmlHttp.responseText != '')
		{
			document.getElementById("albumcovers").innerHTML = xmlHttp.responseText 
		}
	}
}

function showAlbumsContent(pagenowithpath)
{
		var loading="<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" class=\"marginbottom5 fontbold\" height=\"500\"><tr><td valign=\"top\" align=\"left\" class=\"gap10\">&nbsp;</td></tr><tr><td valign=\"top\" align=\"left\" class=\"gap10\">&nbsp;</td></tr><tr><td valign=\"middle\" align=\"center\"><img src=\"images/loader.gif\" border=0></td></tr><tr><td valign=\"top\" align=\"left\" class=\"gap10\">&nbsp;</td></tr><tr><td valign=\"top\" align=\"left\" class=\"gap10\">&nbsp;</td></tr></table>";
		document.getElementById("albumcovers").innerHTML = loading; 
		
		var url=pagenowithpath;
		url=url+"&sid="+Math.random()
		xmlHttp=GetXmlHttpObject()
		if (xmlHttp==null)
		{
			alert ("Browser does not support HTTP Request")
			return
		} 
		xmlHttp.onreadystatechange=onshowAlbumsContent
		xmlHttp.open("GET",url,true) 
		xmlHttp.send(null) 
}

function onshowAlbumsContent()
{
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"	)
	{
		if(xmlHttp.responseText != '')
		{
			document.getElementById("albumcovers").innerHTML = xmlHttp.responseText 
		}
	}
}

function clearComments(boxid)
{
	document.getElementById(boxid).value="";
}

function openMail(rowid,startlimit)
{
	var path="mymails.php?inboxid="+rowid+"&startlimit="+startlimit;
	showFacebox(path);
}

function showDetailMessage(type,messageid,startlimit)
{
	var loading="<table width=\"98%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" class=\"marginbottom5 fontbold\"><tr><td valign=\"top\" align=\"left\" class=\"gap10\">&nbsp;</td></tr><tr><td valign=\"top\" align=\"left\" class=\"gap10\">&nbsp;</td></tr><tr><td valign=\"middle\" align=\"center\"><img src=\"images/loader.gif\" border=0></td></tr><tr><td valign=\"top\" align=\"left\" class=\"gap10\">&nbsp;</td></tr><tr><td valign=\"top\" align=\"left\" class=\"gap10\">&nbsp;</td></tr></table>";
	
	document.getElementById("mailrefresh").innerHTML = loading; 
	var path="controller/profileRegister.php?showdetailMessage=yes&messageid="+messageid+"&type="+type+"&startlimit="+startlimit;
	var url=path;
	url=url+"&sid="+Math.random()
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	{
		alert ("Browser does not support HTTP Request")
		return
	} 
	xmlHttp.onreadystatechange=onshowDetailMessage
	xmlHttp.open("GET",url,true) 
	xmlHttp.send(null) 
}

function onshowDetailMessage()
{
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"	)
	{
		if(xmlHttp.responseText != '')
		{
			document.getElementById("mailrefresh").innerHTML = xmlHttp.responseText 
		}
	}
}

function deleteSelectedMessage(checkboxvalue,controller)
{
	
	var checkbxvalues="";
	var url="controller/"+controller+"&deleteSelectedMsg=yes&deleteid="+checkboxvalue;
	url=url+"&sid="+Math.random()
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	{
		alert ("Browser does not support HTTP Request")
		return
	} 
	xmlHttp.onreadystatechange=ondeleteSelectedMessage
	xmlHttp.open("GET",url,true) 
	xmlHttp.send(null) 
}

function ondeleteSelectedMessage()
{
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"	)
	{
		if(xmlHttp.responseText != '')
		{
			closeBox();
			var path="controller/profileRegister.php?showmails=yes&startlimit="+xmlHttp.responseText;
			showMyMails(path);
		}
	}
}

function inserComment(imageid,userid)
{
	var commentsbox=document.getElementById('commentsbox').value;

	var url="controller/postComment.php?postcomment=yes&userid="+userid+"&commentsbox="+commentsbox+"&imgid="+imageid
	url=url+"&sid="+Math.random()
	
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	{
		alert ("Browser does not support HTTP Request")
		return
	} 
	xmlHttp.onreadystatechange=oninserComment
	xmlHttp.open("GET",url,true) 
	xmlHttp.send(null) 
	
		
}

function oninserComment()
{
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"	)
	{
		if(xmlHttp.responseText != '')
		{
			if(xmlHttp.responseText != 'error')
			{
				document.getElementById("commentsholder").innerHTML = xmlHttp.responseText; 
				document.getElementById('commentsbox').value='';			
			}
			else
			{
				document.getElementById("commenterror").innerHTML = "Plese enter some comments."; 
			}
		}
	}
}

function showCommentsForImage(pagenowithparam)
{
	var url=pagenowithparam;
	url=url+"&sid="+Math.random()
	
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	{
		alert ("Browser does not support HTTP Request")
		return
	} 
	xmlHttp.onreadystatechange=onshowCommentsForImage
	xmlHttp.open("GET",url,true) 
	xmlHttp.send(null) 
}

function onshowCommentsForImage()
{
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"	)
	{
		if(xmlHttp.responseText != '')
		{
			document.getElementById("commentsholder").innerHTML = xmlHttp.responseText; 
		}
	}
}


function confirmDeleteComment(commentid,imageid)
{
	x=confirm("Are you sure you want to delete it?");
	if(x)
	{
		var url="controller/postComment.php?deleteComments=yes&cmtid="+commentid+"&imgid="+imageid;
		url=url+"&sid="+Math.random()
		
		xmlHttp=GetXmlHttpObject()
		if (xmlHttp==null)
		{
			alert ("Browser does not support HTTP Request")
			return
		} 
		xmlHttp.onreadystatechange=onCommentDelete
		xmlHttp.open("GET",url,true) 
		xmlHttp.send(null) 
	}
	{
		return false;
	}
}

function onCommentDelete()
{
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"	)
	{
		if(xmlHttp.responseText != '')
		{
			document.getElementById("commentsholder").innerHTML = xmlHttp.responseText; 
		}
	}
}

function showtitleEdit()
{
	document.getElementById("texted").style.display="none";
	var val=document.getElementById("titleed").style.display;
	if(val=="none")
	{
		document.getElementById("titleed").style.display="";
	}
	else
	{
		document.getElementById("titleed").style.display="none";	
	}
}

function inserTitle(imageid,collectionid)
{
	var titlebox=document.getElementById('titlebox').value;
	if(titlebox=="")
	{
		document.getElementById('titleerror').innerHTML="Please enter some title for the image";
		return false;
	}

	var url="controller/postComment.php?insertTitle=yes&titlebox="+titlebox+"&imgid="+imageid+"&collectionId="+collectionid;
	url=url+"&sid="+Math.random()
	
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	{
		alert ("Browser does not support HTTP Request")
		return
	} 
	xmlHttp.onreadystatechange=oninserTitle
	xmlHttp.open("GET",url,true) 
	xmlHttp.send(null) 
	
		
}

function oninserTitle()
{
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"	)
	{
		if(xmlHttp.responseText != '')
		{
			document.getElementById('titleerror').innerHTML=xmlHttp.responseText;
		}
	}
}

function showtextEdit()
{
	document.getElementById("titleed").style.display="none";
	var val=document.getElementById("texted").style.display;
	if(val=="none")
	{
		document.getElementById("texted").style.display="";
	}
	else
	{
		document.getElementById("texted").style.display="none";	
	}
}

function deleteThisColl(collectionid,imageid,startlimit)
{
	var x=confirm('Are you sure you want to delete this image from your collection?');
	if(x)
	{
	var url="controller/albums.php?deleteThisColl=yes&collectionid="+collectionid+"&imageid="+imageid+"&startlimit="+startlimit;
	url=url+"&sid="+Math.random()
	
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	{
		alert ("Browser does not support HTTP Request")
		return
	} 
	xmlHttp.onreadystatechange=ondeleteThisColl
	xmlHttp.open("GET",url,true) 
	xmlHttp.send(null) 
	}
	else
	{
		return false;
	}
}

function ondeleteThisColl()
{
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"	)
	{
		if(xmlHttp.responseText != '')
		{
			var data= xmlHttp.responseText.split("~");
			var path="controller/albums.php?showAlbumsContent=yes&collectionId="+data[0]+"&startlimit="+data[2];
			closeBox();
			showAlbumsContent(path);
		}
	}
}

function deleteAllColl(collectionid)
{
	var x=confirm('Are you sure you want to delete this collections?');
	if(x)
	{
	var url="controller/albums.php?deleteAllColl=yes&collectionid="+collectionid;
	url=url+"&sid="+Math.random()
	
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	{
		alert ("Browser does not support HTTP Request")
		return
	} 
	xmlHttp.onreadystatechange=ondeleteAllColl
	xmlHttp.open("GET",url,true) 
	xmlHttp.send(null) 
	}
	else
	{
		return false;
	}
}

function ondeleteAllColl()
{
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"	)
	{
		if(xmlHttp.responseText != '')
		{
			closeBox();
			showAlbum()
		}
	}
}

function closeandReloadAlbum(collectionid,startlimit,userid)
{
	var path="controller/albums.php?showAlbumsContent=yes&userid="+userid+"&collectionId="+collectionid+"&startlimit="+startlimit;
	closeBox();
	showAlbumsContent(path);
}

function reloadMsgs(path)
{
	closeBox();
	showMyMails(path);
}

function showMailAndOptions()
{
	document.getElementById("rightcontainerholder").innerHTML = "<table width=\"100%\" border=\"0\" height=\"250\"><tr><td class=\"gap10\">&nbsp;</td></tr><tr><td class=\"gap10\">&nbsp;</td></tr><tr><td valign=\"middle\" align=\"center\"><img src=\"images/loader.gif\" border=0></td></tr></table>";

	var url="controller/profileRegister.php?showmailoptions=yes";
	url=url+"&sid="+Math.random()
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	{
		alert ("Browser does not support HTTP Request")
		return
	} 
	xmlHttp.onreadystatechange=onshowMailAndOptions
	xmlHttp.open("GET",url,true) 
	xmlHttp.send(null) 
}

function onshowMailAndOptions()
{
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"	)
	{
		if(xmlHttp.responseText != '')
		{
			document.getElementById("rightcontainerholder").innerHTML = xmlHttp.responseText ;
			showMyMails("controller/profileRegister.php?showmails=yes&startlimit=0");
		}
	}
}
	
/************************** oubox mail functionality ********************************************/

function showOutboxMails(pagenowithpath)
{
	var loading="<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" class=\"marginbottom5 fontbold\" height=\"500\"><tr><td valign=\"top\" align=\"left\" class=\"gap10\">&nbsp;</td></tr><tr><td valign=\"top\" align=\"left\" class=\"gap10\">&nbsp;</td></tr><tr><td valign=\"middle\" align=\"center\"><img src=\"images/loader.gif\" border=0></td></tr><tr><td valign=\"top\" align=\"left\" class=\"gap10\">&nbsp;</td></tr><tr><td valign=\"top\" align=\"left\" class=\"gap10\">&nbsp;</td></tr></table>";

	document.getElementById("middleconntent").innerHTML = loading; 
	
	var url=pagenowithpath;
	url=url+"&sid="+Math.random()
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	{
		alert ("Browser does not support HTTP Request")
		return
	} 
	xmlHttp.onreadystatechange=onshowOutboxMails
	xmlHttp.open("GET",url,true) 
	xmlHttp.send(null) 
}

function onshowOutboxMails()
{
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"	)
	{
		if(xmlHttp.responseText != '')
		{
			document.getElementById("middleconntent").innerHTML = xmlHttp.responseText 
		}
	}
}

function deleteSelectedOutbox(checkboxname,controller)
{
	
	var checkbx="";
	var checkbxvalues="";
	var tempval="";
	var noofcheckboxes=document.getElementById('ucount').value;
	for(var h=1;h<=noofcheckboxes;h++)
	{
		checkbx=checkboxname+h;
		if(document.getElementById(checkbx).checked)
		{
			tempval=document.getElementById(checkbx).value;
			checkbxvalues=checkbxvalues+tempval+",";
		}
	}
		var url="controller/"+controller+"&deleteSelectedOutbox=yes&deleteid="+checkbxvalues;
		url=url+"&sid="+Math.random()
		
		xmlHttp=GetXmlHttpObject()
		if (xmlHttp==null)
		{
			alert ("Browser does not support HTTP Request")
			return
		} 
		xmlHttp.onreadystatechange=ondeleteSelectedOutbox
		xmlHttp.open("GET",url,true) 
		xmlHttp.send(null) 
		
		
}

function ondeleteSelectedOutbox()
{
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"	)
	{
		if(xmlHttp.responseText != '')
		{
			var path="controller/profileRegister.php?showoutboxmails=yes&startlimit="+xmlHttp.responseText;
			showOutboxMails(path);
		}
	}
}


function openOutboxMail(rowid,startlimit)
{
	var path="myoutboxmails.php?inboxid="+rowid+"&startlimit="+startlimit;
	showFacebox(path);
}

function deleteSelectedOutboxMessage(checkboxvalue,controller)
{
	
	var checkbxvalues="";
	var url="controller/"+controller+"&deleteSelectedOutboxMsg=yes&deleteid="+checkboxvalue;
	url=url+"&sid="+Math.random()
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	{
		alert ("Browser does not support HTTP Request")
		return
	} 
	xmlHttp.onreadystatechange=ondeleteSelectedOutboxMessage
	xmlHttp.open("GET",url,true) 
	xmlHttp.send(null) 
}

function ondeleteSelectedOutboxMessage()
{
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"	)
	{
		if(xmlHttp.responseText != '')
		{
			closeBox();
			var path="controller/profileRegister.php?showoutboxmails=yes&startlimit="+xmlHttp.responseText;
			showOutboxMails(path);
		}
	}
}

function showDetailOutboxMessage(type,messageid,startlimit)
{
	var loading="<table width=\"98%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" class=\"marginbottom5 fontbold\"><tr><td valign=\"top\" align=\"left\" class=\"gap10\">&nbsp;</td></tr><tr><td valign=\"top\" align=\"left\" class=\"gap10\">&nbsp;</td></tr><tr><td valign=\"middle\" align=\"center\"><img src=\"images/loader.gif\" border=0></td></tr><tr><td valign=\"top\" align=\"left\" class=\"gap10\">&nbsp;</td></tr><tr><td valign=\"top\" align=\"left\" class=\"gap10\">&nbsp;</td></tr></table>";
	
	document.getElementById("mailrefresh").innerHTML = loading; 
	var path="controller/profileRegister.php?showdetailOutboxMessage=yes&messageid="+messageid+"&type="+type+"&startlimit="+startlimit;
	var url=path;
	url=url+"&sid="+Math.random()
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	{
		alert ("Browser does not support HTTP Request")
		return
	} 
	xmlHttp.onreadystatechange=onshowDetailOutboxMessage
	xmlHttp.open("GET",url,true) 
	xmlHttp.send(null) 
}

function onshowDetailOutboxMessage()
{
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"	)
	{
		if(xmlHttp.responseText != '')
		{
			document.getElementById("mailrefresh").innerHTML = xmlHttp.responseText 
		}
	}
}

function reloadOutboxMsgs(path)
{
	closeBox();
	showOutboxMails(path);
}

function showOutboxAndOptions()
{
	document.getElementById("rightcontainerholder").innerHTML = "<table width=\"100%\" border=\"0\" height=\"250\"><tr><td class=\"gap10\">&nbsp;</td></tr><tr><td class=\"gap10\">&nbsp;</td></tr><tr><td valign=\"middle\" align=\"center\"><img src=\"images/loader.gif\" border=0></td></tr></table>";

	var url="view/mailsOption.php";
	url=url+"?sid="+Math.random()
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	{
		alert ("Browser does not support HTTP Request")
		return
	} 
	xmlHttp.onreadystatechange=onshowOutboxAndOptions
	xmlHttp.open("GET",url,true) 
	xmlHttp.send(null) 
}

function onshowOutboxAndOptions()
{
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"	)
	{
		if(xmlHttp.responseText != '')
		{
			document.getElementById("rightcontainerholder").innerHTML = xmlHttp.responseText ;
			showOutboxMails('controller/profileRegister.php?showoutboxmails=yes&startlimit=0');
		}
	}
}


/* compose mail related functionality */


function addtoemail(name)
{
	var temp2=document.getElementById('toemail').value;
	if(temp2=="" )
	{
		temp2=name;
	}
	else
	{
		temp2=temp2+","+name;
	}
	document.getElementById('toemail').value=temp2;
}

function sendMailall()
{
	var toemail=document.getElementById('toemail').value;
	var subject=document.getElementById('subject').value;
	var message=document.getElementById('message').value;
	
	if(toemail=="")
	{
		alert("Please enter the names seperated by comma like = , ");
		document.getElementById('toemail').focus();
		return false;
	}

	if(subject=="")
	{
		alert("Please enter the subject ");
		document.getElementById('subject').focus();
		return false;
	}

	if(message=="")
	{
		alert("Please enter some message");
		document.getElementById('message').focus();
		return false;
	}
	var path="controller/profileRegister.php?sendmails=yes&toemail="+toemail+"&subject="+subject+"&message="+message;
	var url=path;
	url=url+"&sid="+Math.random()
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	{
		alert ("Browser does not support HTTP Request")
		return
	} 
	xmlHttp.onreadystatechange=onsendMailall
	xmlHttp.open("GET",url,true) 
	xmlHttp.send(null) 
}

function onsendMailall()
{
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"	)
	{
		if(xmlHttp.responseText != '')
		{
			closeBox(); 
			showMyMails("controller/profileRegister.php?showmails=yes&startlimit=0");
		}
	}
}
function send_mail(frnid)
{
	var toemail=document.getElementById('toemail').value;
	
	if(toemail=="")
	{
		alert("Please enter the names seperated by comma like = , ");
		document.getElementById('toemail').focus();
		return false;
	}

	
	var path="controller/profileRegister.php?send_mails=yes&toemail="+toemail+"&refernd="+frnid+"&hook=yes";
	var url=path;
	url=url+"&sid="+Math.random()
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	{
		alert ("Browser does not support HTTP Request")
		return
	} 
	xmlHttp.onreadystatechange=onsend_mail
	xmlHttp.open("GET",url,true) 
	xmlHttp.send(null) 
}

function onsend_mail()
{
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"	)
	{
		
		if(xmlHttp.responseText != '')
		{
			closeBox(); 
			
		}
	}
}
function closeBoxandShowAlbumList()
{
	//showAlbum();
	closeBox();
	location.href="index.php?page=12";
}

function replymsg(msgid)
{
	var path="replycompose.php?messageid="+msgid;
	showFacebox(path);
}

function showDetailMessageBack(inboxid)
{
	var path="mymails.php?inboxid="+inboxid;
	showFacebox(path);
}

function forwardmsg(msgid)
{
	var path="forwardcompose.php?messageid="+msgid;
	showFacebox(path);
}

/* vie my profile related functionality */

function viewMyProfile(generalid)
{
	var loading="<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" class=\"marginbottom5 fontbold\" height=\"500\"><tr><td valign=\"top\" align=\"left\" class=\"gap10\">&nbsp;</td></tr><tr><td valign=\"top\" align=\"left\" class=\"gap10\">&nbsp;</td></tr><tr><td valign=\"middle\" align=\"center\"><img src=\"images/loader.gif\" border=0></td></tr><tr><td valign=\"top\" align=\"left\" class=\"gap10\">&nbsp;</td></tr><tr><td valign=\"top\" align=\"left\" class=\"gap10\">&nbsp;</td></tr></table>";
	document.getElementById("middleconntent").innerHTML = loading; 
	var path="view/profileView.php?generalid="+generalid;
	var url=path;
	url=url+"&sid="+Math.random()
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	{
		alert ("Browser does not support HTTP Request")
		return
	} 
	xmlHttp.onreadystatechange=onviewMyProfile
	xmlHttp.open("GET",url,true) 
	xmlHttp.send(null) 
}

function onviewMyProfile()
{
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"	)
	{
		if(xmlHttp.responseText != '')
		{
			document.getElementById("middleconntent").innerHTML = xmlHttp.responseText
/*			showFriendRequest();
*/		}
	}
}

function showallfriends(pagewithpath)
{
	var loading="<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" class=\"marginbottom5 fontbold\" height=\"300\"><tr><td valign=\"top\" align=\"left\" class=\"gap10\">&nbsp;</td></tr><tr><td valign=\"top\" align=\"left\" class=\"gap10\">&nbsp;</td></tr><tr><td valign=\"middle\" align=\"center\"><img src=\"images/loader.gif\" border=0></td></tr><tr><td valign=\"top\" align=\"left\" class=\"gap10\">&nbsp;</td></tr><tr><td valign=\"top\" align=\"left\" class=\"gap10\">&nbsp;</td></tr></table>";
	document.getElementById("middleconntent").innerHTML = loading; 
	var path=pagewithpath;
	var url=path;
	url=url+"&sid="+Math.random()
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	{
		alert ("Browser does not support HTTP Request")
		return
	} 
	xmlHttp.onreadystatechange=onshowallfriends
	xmlHttp.open("GET",url,true) 
	xmlHttp.send(null) 
}

function onshowallfriends()
{
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"	)
	{
		if(xmlHttp.responseText != '')
		{
			document.getElementById("middleconntent").innerHTML = xmlHttp.responseText 
		}
	}
}

function showrecentactivity(pagewithpath)
{
	var loading="<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" class=\"marginbottom5 fontbold\" height=\"300\"><tr><td valign=\"top\" align=\"left\" class=\"gap10\">&nbsp;</td></tr><tr><td valign=\"top\" align=\"left\" class=\"gap10\">&nbsp;</td></tr><tr><td valign=\"middle\" align=\"center\"><img src=\"images/loader.gif\" border=0></td></tr><tr><td valign=\"top\" align=\"left\" class=\"gap10\">&nbsp;</td></tr><tr><td valign=\"top\" align=\"left\" class=\"gap10\">&nbsp;</td></tr></table>";
	document.getElementById("viewallfriendslist").innerHTML = loading; 
	var path=pagewithpath;
	var url=path;
	url=url+"&sid="+Math.random()
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	{
		alert ("Browser does not support HTTP Request")
		return
	} 
	xmlHttp.onreadystatechange=onshowrecentactivity
	xmlHttp.open("GET",url,true) 
	xmlHttp.send(null) 
}

function onshowrecentactivity()
{
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"	)
	{
		if(xmlHttp.responseText != '')
		{
			document.getElementById("viewallfriendslist").innerHTML = xmlHttp.responseText 
		}
	}
}

function acceptFreind(userid,friendid,page)
{
	var nm="fritype";
	var temp1="";
	for(var d=1;d<=2;d++)
	{
		if(document.getElementById(nm+d).checked)
		{
			temp1=document.getElementById(nm+d).value;
		}
	}
	
	var path="controller/friendsRequest.php?friendrequest=accept&userid="+userid+"&friendid="+friendid+"&page="+page+"&type="+temp1;
	var url=path;
	url=url+"&sid="+Math.random()
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	{
		alert ("Browser does not support HTTP Request")
		return
	} 
	xmlHttp.onreadystatechange=onacceptFreind
	xmlHttp.open("GET",url,true) 
	xmlHttp.send(null) 
}

function onacceptFreind()
{
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"	)
	{
		if(xmlHttp.responseText != '')
		{
			closeBox();
/*			showFriendRequest();
*/		
		location.href="index.php?page="+xmlHttp.responseText;
		}
	}
}

function rejectFreind(userid,friendid,page)
{
	var path="controller/friendsRequest.php?friendrequest=reject&userid="+userid+"&friendid="+friendid+"&page="+page;
	var url=path;
	url=url+"&sid="+Math.random()
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	{
		alert ("Browser does not support HTTP Request")
		return
	} 
	xmlHttp.onreadystatechange=onrejectFreind
	xmlHttp.open("GET",url,true) 
	xmlHttp.send(null) 
}

function onrejectFreind()
{
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"	)
	{
		if(xmlHttp.responseText != '')
		{
			closeBox();
/*			showFriendRequest();
*/		
		location.href="index.php?page="+xmlHttp.responseText;
		}
	}
}

function rejectFreindAndHookUp(userid,friendid,page)
{
	var path="controller/friendsRequest.php?friendrequesthook=reject&userid="+userid+"&friendid="+friendid+"&page="+page;
	var url=path;
	url=url+"&sid="+Math.random()
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	{
		alert ("Browser does not support HTTP Request")
		return
	} 
	xmlHttp.onreadystatechange=onrejectFreindAndHookUp
	xmlHttp.open("GET",url,true) 
	xmlHttp.send(null) 
}

function onrejectFreindAndHookUp()
{
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"	)
	{
		if(xmlHttp.responseText != '')
		{
			var datas=xmlHttp.responseText.split('~');
			var pathshw="refer_compose.php?generalid="+datas[0];
			showFacebox(pathshw);
		}
	}
}


function showFriendRequest()
{
	document.getElementById("spanfriendrequest").innerHTML = "<table width=\"100%\" border=\"0\" height=\"250\"><tr><td class=\"gap10\">&nbsp;</td></tr><tr><td class=\"gap10\">&nbsp;</td></tr><tr><td valign=\"middle\" align=\"center\"><img src=\"images/loader.gif\" border=0></td></tr></table>";
	var path="view/friendRequest.php";
	var url=path;
	url=url+"?sid="+Math.random()
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	{
		alert ("Browser does not support HTTP Request")
		return
	} 
	xmlHttp.onreadystatechange=onshowFriendRequest
	xmlHttp.open("GET",url,true) 
	xmlHttp.send(null) 
}

function onshowFriendRequest()
{
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"	)
	{
		if(xmlHttp.responseText != '')
		{
			document.getElementById("spanfriendrequest").innerHTML = xmlHttp.responseText ;
		}
	}
}

function invitePeoples()
{
	var emailids=document.getElementById('invitefriends').value
	if(emailids=="")
	{
		alert('Please Enter Email-id');
		return false;
	}
	if(emailids=="enter friend's email")
	{
		alert('Please Enter Email-id');
		return false;
	}
/*	alert(emailids);
*/	
	var path="controller/inviteFriends.php?invitefriends=yes&emailids="+emailids;
	var url=path;
	url=url+"&sid="+Math.random()
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	{
		alert ("Browser does not support HTTP Request")
		return
	} 
	xmlHttp.onreadystatechange=oninvitePeoples
	xmlHttp.open("GET",url,true) 
	xmlHttp.send(null) 
}

function oninvitePeoples()
{
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"	)
	{
		if(xmlHttp.responseText != '')
		{
			document.getElementById('invitefriends').value="";
			//alert('You have successfully invited the friends');
			displayerror(13,'none');
			//alert('You need to login to view his/her profile');
			return false;
		}
	}
}

function searchFriends(paramwithpageno)
{
	var searchtext=document.getElementById('searchfriends').value;
	if(searchtext=="")
	{
		alert('Please enter some name/email-id to search for the peoples');
		return false;
	}
	
	var path=paramwithpageno+"&searchtext="+searchtext;
	var url=path;
	url=url+"&sid="+Math.random()
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	{
		alert ("Browser does not support HTTP Request")
		return
	} 
	xmlHttp.onreadystatechange=onsearchFriends
	xmlHttp.open("GET",url,true) 
	xmlHttp.send(null) 
}

function onsearchFriends()
{
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"	)
	{
		if(xmlHttp.responseText != '')
		{
			document.getElementById("middleconntent").innerHTML = xmlHttp.responseText
		}
	}
}

function addasFreind(userid,friendid)
{
	var nm="fritype";
	var temp1="";
	for(var d=1;d<=2;d++)
	{
		if(document.getElementById(nm+d).checked)
		{
			temp1=document.getElementById(nm+d).value;
		}
	}
	
	var path="controller/friendsRequest.php?friendrequest=add&userid="+userid+"&friendid="+friendid+"&type="+temp1;
	var url=path;
	url=url+"&sid="+Math.random()
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	{
		alert ("Browser does not support HTTP Request")
		return
	} 
	xmlHttp.onreadystatechange=onaddasFreind
	xmlHttp.open("GET",url,true) 
	xmlHttp.send(null) 
}

function onaddasFreind()
{
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"	)
	{
		if(xmlHttp.responseText != '')
		{
			closeBox();
		}
	}
}

function loggedIn()
{
	closeBox();
	location.href="index.php";
}

function viewMyProfile2(generalid)
{
	var loading="<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" class=\"marginbottom5 fontbold\" height=\"500\"><tr><td valign=\"top\" align=\"left\" class=\"gap10\">&nbsp;</td></tr><tr><td valign=\"top\" align=\"left\" class=\"gap10\">&nbsp;</td></tr><tr><td valign=\"middle\" align=\"center\"><img src=\"images/loader.gif\" border=0></td></tr><tr><td valign=\"top\" align=\"left\" class=\"gap10\">&nbsp;</td></tr><tr><td valign=\"top\" align=\"left\" class=\"gap10\">&nbsp;</td></tr></table>";
	document.getElementById("middleconntent").innerHTML = loading; 
	var path="view/profileView.php?generalid="+generalid;
	var url=path;
	url=url+"&sid="+Math.random()
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	{
		alert ("Browser does not support HTTP Request")
		return
	} 
	xmlHttp.onreadystatechange=onviewMyProfile2
	xmlHttp.open("GET",url,true) 
	xmlHttp.send(null) 
}

function onviewMyProfile2()
{
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"	)
	{
		if(xmlHttp.responseText != '')
		{
			document.getElementById("middleconntent").innerHTML = xmlHttp.responseText
			showFriendRequest();
		}
	}
}



function searchFriendsFromHome()
{
	var gender1=document.getElementById('gender1').value;
	var gender2=document.getElementById('gender2').value;
	var age1=document.getElementById('age1').value;
	var age2=document.getElementById('age2').value;
	var usrnm=document.getElementById('usrnm').value;
	var email=document.getElementById('email').value;
	var country=document.getElementById('country').value;
	var state=document.getElementById('state').value;
	var city=document.getElementById('city').value;
	var sign=document.getElementById('sign').value;
/*	var zip=document.getElementById('zip').value;
*/

	var onl="";
	if(document.getElementById('onl').checked)
	{
		onl="online";
	}
	
	var pht="";
	
	if(document.getElementById('pht').checked)
	{
		pht="yes";
	}
	
	
	
	var loading="<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" class=\"marginbottom5 fontbold\" height=\"500\"><tr><td valign=\"top\" align=\"left\" class=\"gap10\">&nbsp;</td></tr><tr><td valign=\"top\" align=\"left\" class=\"gap10\">&nbsp;</td></tr><tr><td valign=\"middle\" align=\"center\"><img src=\"images/loader.gif\" border=0></td></tr><tr><td valign=\"top\" align=\"left\" class=\"gap10\">&nbsp;</td></tr><tr><td valign=\"top\" align=\"left\" class=\"gap10\">&nbsp;</td></tr></table>";

	document.getElementById("middleconntent").innerHTML = loading; 
	
	var path="controller/searchFriends.php?searchfriendsfromhome=yes&gender1="+gender1+"&gender2="+gender2+"&age1="+age1+"&age2="+age2+"&usrnm="+usrnm+"&email="+email+"&country="+country+"&city="+city/*+"&zip="+zip*/+"&startlimit=0&state="+state+"&onl="+onl+"&pht="+pht+"&sign="+sign;
	var url=path;
	url=url+"&sid="+Math.random()
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	{
		alert ("Browser does not support HTTP Request")
		return
	} 
	xmlHttp.onreadystatechange=onsearchFriendsFromHome
	xmlHttp.open("GET",url,true) 
	xmlHttp.send(null) 
}

function onsearchFriendsFromHome()
{
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"	)
	{
		if(xmlHttp.responseText != '')
		{
			document.getElementById("middleconntent").innerHTML = xmlHttp.responseText
		}
	}
}

function searchFriendsFromHomePaging(pagenowithparam)
{
	var loading="<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" class=\"marginbottom5 fontbold\" height=\"500\"><tr><td valign=\"top\" align=\"left\" class=\"gap10\">&nbsp;</td></tr><tr><td valign=\"top\" align=\"left\" class=\"gap10\">&nbsp;</td></tr><tr><td valign=\"middle\" align=\"center\"><img src=\"images/loader.gif\" border=0></td></tr><tr><td valign=\"top\" align=\"left\" class=\"gap10\">&nbsp;</td></tr><tr><td valign=\"top\" align=\"left\" class=\"gap10\">&nbsp;</td></tr></table>";

	document.getElementById("middleconntent").innerHTML = loading; 
	var path=pagenowithparam;
	var url=path;
	url=url+"&sid="+Math.random()
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	{
		alert ("Browser does not support HTTP Request")
		return
	} 
	xmlHttp.onreadystatechange=onsearchFriendsFromHomePaging
	xmlHttp.open("GET",url,true) 
	xmlHttp.send(null) 
}

function onsearchFriendsFromHomePaging()
{
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"	)
	{
		if(xmlHttp.responseText != '')
		{
			document.getElementById("middleconntent").innerHTML = xmlHttp.responseText
		}
	}
}

function randomImageDisplay(imageid,ratedvalue)
{
	var gender="";
	var sex="sex";
	for(var l=1;l<=2;l++)
	{
		if(document.getElementById(sex+l).checked)
		{
			gender=document.getElementById(sex+l).value;
		}
	}
	
	var url="view/middleImage.php?imageafterrating=yes&userpresent=no&imageid="+imageid+"&ratedvalue="+ratedvalue+"&gender="+gender;
	url=url+"&sid="+Math.random()
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	{
		alert ("Browser does not support HTTP Request")
		return
	} 
	xmlHttp.onreadystatechange=onrandomImageDisplay
	xmlHttp.open("GET",url,true) 
	xmlHttp.send(null) 
}

function onrandomImageDisplay()
{
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"	)
	{
		if(xmlHttp.responseText != '')
		{
			document.getElementById("mymiddleimage").innerHTML = xmlHttp.responseText
			var gender="";
			var sex="sex";
			for(var l=1;l<=2;l++)
			{
				if(document.getElementById(sex+l).checked)
				{
					var g1=sex+l;
					gender=document.getElementById(g1).value;
				}
			}
	
			var url="view/middleImage.php?imageafterratingupnext=yes&userpresent=no&gender="+gender;
			url=url+"&sid="+Math.random()
			xmlHttp=GetXmlHttpObject()
			if (xmlHttp==null)
			{
				alert ("Browser does not support HTTP Request")
				return
			} 
			xmlHttp.onreadystatechange=ongetUpNext
			xmlHttp.open("GET",url,true) 
			xmlHttp.send(null) 
			
		}
	}
}

function ongetUpNext()
{
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"	)
	{
		if(xmlHttp.responseText != '')
		{
			document.getElementById("upnext").innerHTML = xmlHttp.responseText
		}
	}
}


function middleImageDisplay()
{
	var url="view/middleImage.php?middleimagedisplay=yes";
	url=url+"&sid="+Math.random()
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	{
		alert ("Browser does not support HTTP Request")
		return
	} 
	xmlHttp.onreadystatechange=onmiddleImageDisplay
	xmlHttp.open("GET",url,true) 
	xmlHttp.send(null) 
}

function onmiddleImageDisplay()
{
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"	)
	{
		if(xmlHttp.responseText != '')
		{
			document.getElementById("mymiddleimage").innerHTML = xmlHttp.responseText;
		}
	}
}


function randomImageDisplayWithLogin(imageid,ratedvalue)
{
	var gender="";
	var sex="sex";
	for(var l=1;l<=2;l++)
	{
		if(document.getElementById(sex+l).checked)
		{
			gender=document.getElementById(sex+l).value;
		}
	}
	
	var url="view/middleImage.php?imageafterrating=yes&imageid="+imageid+"&ratedvalue="+ratedvalue+"&userpresent=yes&gender="+gender;
	url=url+"&sid="+Math.random()
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	{
		alert ("Browser does not support HTTP Request")
		return
	} 
	xmlHttp.onreadystatechange=onrandomImageDisplayWithLogin
	xmlHttp.open("GET",url,true) 
	xmlHttp.send(null) 
}

function onrandomImageDisplayWithLogin()
{
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"	)
	{
		if(xmlHttp.responseText != '')
		{
			document.getElementById("mymiddleimage").innerHTML = xmlHttp.responseText
			var gender="";
			var sex="sex";
			for(var l=1;l<=2;l++)
			{
				if(document.getElementById(sex+l).checked)
				{
					gender=document.getElementById(sex+l).value;
				}
			}
	
			var url="view/middleImage.php?imageafterratingupnext=yes&userpresent=no&gender="+gender;
			url=url+"&sid="+Math.random()
			xmlHttp=GetXmlHttpObject()
			if (xmlHttp==null)
			{
				alert ("Browser does not support HTTP Request")
				return
			} 
			xmlHttp.onreadystatechange=ongetUpNext
			xmlHttp.open("GET",url,true) 
			xmlHttp.send(null) 
			
		}
	}
}

function loginpls(id)
{
	displayerror(1,'none');
	//alert('You need to login to view his/her profile');
	return false;
}

function sendMailNoRefresh()
{
	var toemail=document.getElementById('toemail').value;
	var subject=document.getElementById('subject').value;
	var message=document.getElementById('message').value;
	
	if(toemail=="")
	{
		alert("Please enter the names seperated by comma like = , ");
		document.getElementById('toemail').focus();
		return false;
	}

	if(subject=="")
	{
		alert("Please enter the subject ");
		document.getElementById('subject').focus();
		return false;
	}

	if(message=="")
	{
		alert("Please enter some message");
		document.getElementById('message').focus();
		return false;
	}
	
	var path="controller/profileRegister.php?sendmails=yes&toemail="+toemail+"&subject="+subject+"&message="+message;
	var url=path;
	url=url+"&sid="+Math.random()
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	{
		alert ("Browser does not support HTTP Request")
		return
	} 
	xmlHttp.onreadystatechange=onsendMailNoRefresh
	xmlHttp.open("GET",url,true) 
	xmlHttp.send(null) 
}

function onsendMailNoRefresh()
{
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"	)
	{
		if(xmlHttp.responseText != '')
		{
			closeBox(); 
		}
	}
}

function acceptInviteChat(otheruserid)
{
	
	var path="controller/profileRegister.php?acceptchatinv=yes&otheruserid="+otheruserid;
	var url=path;
	url=url+"&sid="+Math.random()
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	{
		alert ("Browser does not support HTTP Request")
		return
	} 
	xmlHttp.onreadystatechange=onacceptInviteChat
	xmlHttp.open("GET",url,true) 
	xmlHttp.send(null) 
}

function onacceptInviteChat()
{
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"	)
	{
		if(xmlHttp.responseText != '')
		{
			closeBox(); 
		}
	}
}

function declineInviteChat(otheruserid)
{
	
	var path="controller/profileRegister.php?declinechatinv=yes&otheruserid="+otheruserid;
	var url=path;
	url=url+"&sid="+Math.random()
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	{
		alert ("Browser does not support HTTP Request")
		return
	} 
	xmlHttp.onreadystatechange=ondeclineInviteChat
	xmlHttp.open("GET",url,true) 
	xmlHttp.send(null) 
}

function ondeclineInviteChat()
{
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"	)
	{
		if(xmlHttp.responseText != '')
		{
			closeBox(); 
		}
	}
}



function sendChatInvitation(username)
{
	
	var path="controller/profileRegister.php?sendchatmsg=yes&username="+username;
	var url=path;
	url=url+"&sid="+Math.random()
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	{
		alert ("Browser does not support HTTP Request")
		return
	} 
	xmlHttp.onreadystatechange=onsendChatInvitation
	xmlHttp.open("GET",url,true) 
	xmlHttp.send(null) 
}

function onsendChatInvitation()
{
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"	)
	{
		if(xmlHttp.responseText != '')
		{
			closeBox(); 
		}
	}
}

function displayerror(errorno,boxid)
{
	var path="displayerror.php?errorno="+errorno+"&boxid="+boxid;
	showFacebox(path);
}

function closeBox2(boxid)
{
	$(document).trigger('close.facebox')
	if(boxid!="none")
	{
		document.getElementById(boxid).focus();
	}
	return false;
}

function getStateLists()
{
	var countryid=document.getElementById('country').value;
	var path="function.php?displaystate=yes&countryid="+countryid;
	var url=path;
	url=url+"&sid="+Math.random()
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	{
		alert ("Browser does not support HTTP Request")
		return
	} 
	xmlHttp.onreadystatechange=onStateavail
	xmlHttp.open("GET",url,true) 
	xmlHttp.send(null) 
}

function onStateavail()
{
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"	)
	{
		if(xmlHttp.responseText != '')
		{
			document.getElementById('statelists').innerHTML=xmlHttp.responseText;
		}
	}
}

function getCityLists()
{
	var stateid=document.getElementById('state').value;
	var path="function.php?displaycity=yes&stateid="+stateid;
	var url=path;
	url=url+"&sid="+Math.random()
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	{
		alert ("Browser does not support HTTP Request")
		return
	} 
	xmlHttp.onreadystatechange=onCityavail
	xmlHttp.open("GET",url,true) 
	xmlHttp.send(null) 
}

function onCityavail()
{
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"	)
	{
		if(xmlHttp.responseText != '')
		{
			document.getElementById('citylists').innerHTML=xmlHttp.responseText;
		}
	}
}


function getCityListsForSearch()
{
	var stateid=document.getElementById('state').value;
	var path="function.php?displaycityforsearch=yes&stateid="+stateid;
	var url=path;
	url=url+"&sid="+Math.random()
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	{
		alert ("Browser does not support HTTP Request")
		return
	} 
	xmlHttp.onreadystatechange=ongetCityListsForSearch
	xmlHttp.open("GET",url,true) 
	xmlHttp.send(null) 
}
function ongetCityListsForSearch()
{
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"	)
	{
		if(xmlHttp.responseText != '')
		{
			document.getElementById('citylistsforsearch').innerHTML=xmlHttp.responseText;
		}
	}
}


function getStateListsForSearch()
{
	var countryid=document.getElementById('country').value;
	var path="function.php?displaystateforsearch=yes&countryid="+countryid;
	var url=path;
	url=url+"&sid="+Math.random()
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	{
		alert ("Browser does not support HTTP Request")
		return
	} 
	xmlHttp.onreadystatechange=ongetStateListsForSearch
	xmlHttp.open("GET",url,true) 
	xmlHttp.send(null) 
}

function ongetStateListsForSearch()
{
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"	)
	{
		if(xmlHttp.responseText != '')
		{
			document.getElementById('statelistsforsearch').innerHTML=xmlHttp.responseText;
		}
	}
}



/* video collection part */

function showVideosAlbum()
{
	document.getElementById("rightcontainerholder").innerHTML = "<table width=\"100%\" border=\"0\" height=\"250\"><tr><td class=\"gap10\">&nbsp;</td></tr><tr><td class=\"gap10\">&nbsp;</td></tr><tr><td valign=\"middle\" align=\"center\"><img src=\"images/loader.gif\" border=0></td></tr></table>";

	var url="view/videoAlbum.php?getAlbumsOption=yes";
	url=url+"&sid="+Math.random()
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	{
		alert ("Browser does not support HTTP Request")
		return
	} 
	xmlHttp.onreadystatechange=onshowVideosAlbum
	xmlHttp.open("GET",url,true) 
	xmlHttp.send(null) 
}

function onshowVideosAlbum()
{
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"	)
	{
		if(xmlHttp.responseText != '')
		{
			document.getElementById("rightcontainerholder").innerHTML = xmlHttp.responseText ;
			showVideoAlbumsList("view/videoAlbum.php?showAlbumslist=yes&startlimit=0");
		}
	}
}
	
function createVideoCollnew()
{
	document.getElementById("uploadoption").innerHTML = "<table width=\"100%\" border=\"0\" height=\"250\"><tr><td class=\"gap10\">&nbsp;</td></tr><tr><td class=\"gap10\">&nbsp;</td></tr><tr><td valign=\"middle\" align=\"center\"><img src=\"images/loader.gif\" border=0></td></tr></table>";

	var url="view/videoAlbum.php?showAlbumCreate=yes";
	url=url+"&sid="+Math.random()
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	{
		alert ("Browser does not support HTTP Request")
		return
	} 
	xmlHttp.onreadystatechange=oncreateVideoCollnew
	xmlHttp.open("GET",url,true) 
	xmlHttp.send(null) 
}

function oncreateVideoCollnew()
{
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"	)
	{
		if(xmlHttp.responseText != '')
		{
			document.getElementById("uploadoption").innerHTML = xmlHttp.responseText 
		}
	}
}

function showVideoAlbumsOption()
{
	document.getElementById("uploadoption").innerHTML = "<table width=\"100%\" border=\"0\" height=\"250\"><tr><td class=\"gap10\">&nbsp;</td></tr><tr><td class=\"gap10\">&nbsp;</td></tr><tr><td valign=\"middle\" align=\"center\"><img src=\"images/loader.gif\" border=0></td></tr></table>";
		var url="view/videoAlbum.php?showAlbumUpload=yes";
		url=url+"&sid="+Math.random()
		
		xmlHttp=GetXmlHttpObject()
		if (xmlHttp==null)
		{
			alert ("Browser does not support HTTP Request")
			return
		} 
		xmlHttp.onreadystatechange=onshowVideoAlbumsOption
		xmlHttp.open("GET",url,true) 
		xmlHttp.send(null) 
		
		
}

function onshowVideoAlbumsOption()
{
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"	)
	{
		if(xmlHttp.responseText != '')
		{
			document.getElementById("uploadoption").innerHTML = xmlHttp.responseText 
		}
	}
}

function createVideoAlbum()
{
		var newalbum=document.getElementById("newalbum").value;
		if(newalbum=="")
		{
			document.getElementById("errorphoto").innerHTML="Please enter the Collection name.";
			return false;
		}
		
		var privacy=document.getElementById("privacy").value;
		
		var url="view/videoAlbum.php?setAlbum=yes&newalbum="+newalbum+"&privacy="+privacy
		url=url+"&sid="+Math.random()
		
		xmlHttp=GetXmlHttpObject()
		if (xmlHttp==null)
		{
			alert ("Browser does not support HTTP Request")
			return
		} 
		xmlHttp.onreadystatechange=oncreateVideoAlbum
		xmlHttp.open("GET",url,true) 
		xmlHttp.send(null) 
		
		
}

function oncreateVideoAlbum()
{
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"	)
	{
		if(xmlHttp.responseText != '')
		{
			document.getElementById("uploadoption").innerHTML = xmlHttp.responseText 
		}
	}
}

function setParamsForVideo(userid)
{
	var collList=document.getElementById('collList').value;
	var path="uploadVideoAlbum.php?&collList="+collList+"&userid="+userid;
	showFacebox(path);
}

function showVideoAlbumsList(pagenowithpath)
{
		var loading="<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" class=\"marginbottom5 fontbold\" height=\"500\"><tr><td valign=\"top\" align=\"left\" class=\"gap10\">&nbsp;</td></tr><tr><td valign=\"top\" align=\"left\" class=\"gap10\">&nbsp;</td></tr><tr><td valign=\"middle\" align=\"center\"><img src=\"images/loader.gif\" border=0></td></tr><tr><td valign=\"top\" align=\"left\" class=\"gap10\">&nbsp;</td></tr><tr><td valign=\"top\" align=\"left\" class=\"gap10\">&nbsp;</td></tr></table>";
		document.getElementById("middleconntent").innerHTML = loading; 
		
		var url=pagenowithpath;
		url=url+"&sid="+Math.random()
		xmlHttp=GetXmlHttpObject()
		if (xmlHttp==null)
		{
			alert ("Browser does not support HTTP Request")
			return
		} 
		xmlHttp.onreadystatechange=onshowVideoAlbumsList
		xmlHttp.open("GET",url,true) 
		xmlHttp.send(null) 
}

function onshowVideoAlbumsList()
{
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"	)
	{
		if(xmlHttp.responseText != '')
		{
			document.getElementById("middleconntent").innerHTML = xmlHttp.responseText 
		}
	}
}

function closeBoxandShowVideoAlbumList()
{
/*	showVideosAlbum();
	closeBox();
*/
	location.href="index.php?page=15";
}

function backtoVideoalbums(collectionid,startlimit,userid)
{
	var path="view/videoAlbum.php?showAlbumsContent=yes&userid="+userid+"&collectionid="+collectionid+"&startlimit="+startlimit;
	showVideoAlbumsList(path);
	
}

function deleteVideoFile(videoid)
{
	x=confirm("Are you sure you want to delete it?");
	if(x)
	{
		var url="view/videoAlbum.php?deleteVideo=yes&videoid="+videoid;
		url=url+"&sid="+Math.random()
		xmlHttp=GetXmlHttpObject()
		if (xmlHttp==null)
		{
			alert ("Browser does not support HTTP Request")
			return
		} 
		xmlHttp.onreadystatechange=ondeleteVideoFile
		xmlHttp.open("GET",url,true) 
		xmlHttp.send(null) 
	}
	else
	{
		return false;
	}
}

function ondeleteVideoFile()
{
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"	)
	{
		if(xmlHttp.responseText != '')
		{
			location.href="index.php?page=15";
		}
	}
}

function editVideoInf(collectionid,videoid)
{
	var path="editVideoInfo.php?collectionid="+collectionid+"&videoid="+videoid;
	showFacebox(path);
}

function editVideoInfo(videoid)
{
/*	var collectionid=document.getElementById('collectionid').value
*/	
	var videoname=document.getElementById('vn'+videoid).value
	var description=document.getElementById('desc'+videoid).value
	
	var url="view/videoAlbum.php?editInfo=yes&videoid="+videoid+"&videoname="+videoname+"&description="+description;
	url=url+"&sid="+Math.random()
	
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	{
		alert ("Browser does not support HTTP Request")
		return
	} 
	xmlHttp.onreadystatechange=oneditVideoInfo
	xmlHttp.open("GET",url,true) 
	xmlHttp.send(null) 
}

function oneditVideoInfo()
{
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"	)
	{
		if(xmlHttp.responseText != '')
		{
			location.href="index.php?page=15";
		}
	}
}

function playVideoFile(collectionid,videoid,userid,prevpagenum)
{
	var url="view/videoAlbum.php?showVideos=yes&collectionid="+collectionid+"&videoid="+videoid+"&userid="+userid+"&prevpagenum="+prevpagenum;
	url=url+"&sid="+Math.random()
	
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	{
		alert ("Browser does not support HTTP Request")
		return
	} 
	xmlHttp.onreadystatechange=onplayVideoFile
	xmlHttp.open("GET",url,true) 
	xmlHttp.send(null) 
}

function onplayVideoFile()
{
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"	)
	{
		if(xmlHttp.responseText != '')
		{
			document.getElementById("albumcovers").innerHTML = xmlHttp.responseText 
		}
	}
}

function viewMyProfile3(generalid)
{
	var loading="<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" class=\"marginbottom5 fontbold\" height=\"500\"><tr><td valign=\"top\" align=\"left\" class=\"gap10\">&nbsp;</td></tr><tr><td valign=\"top\" align=\"left\" class=\"gap10\">&nbsp;</td></tr><tr><td valign=\"middle\" align=\"center\"><img src=\"images/loader.gif\" border=0></td></tr><tr><td valign=\"top\" align=\"left\" class=\"gap10\">&nbsp;</td></tr><tr><td valign=\"top\" align=\"left\" class=\"gap10\">&nbsp;</td></tr></table>";
	document.getElementById("middleconntent").innerHTML = loading; 
	var path="view/profileView.php?generalid="+generalid;
	var url=path;
	url=url+"&sid="+Math.random()
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	{
		alert ("Browser does not support HTTP Request")
		return
	} 
	xmlHttp.onreadystatechange=onviewMyProfile3
	xmlHttp.open("GET",url,true) 
	xmlHttp.send(null) 
}

function onviewMyProfile3()
{
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"	)
	{
		if(xmlHttp.responseText != '')
		{
			document.getElementById("middleconntent").innerHTML = xmlHttp.responseText
			showEditProfileBox();
		}
	}
}

function editAboutMeDetails()
{
	var editme=document.getElementById("aboutme").value;
	if(editme=="")
	{
		displayerror(12,'aboutme');
		//alert('Please select the city');
		return false;
	}
	
	var path="controller/profileRegister.php?updateAboutMe=yes&editme="+editme;
	var url=path;
	url=url+"&sid="+Math.random()
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	{
		alert ("Browser does not support HTTP Request")
		return
	} 
	xmlHttp.onreadystatechange=oneditAboutMeDetails
	xmlHttp.open("GET",url,true) 
	xmlHttp.send(null) 
}

function oneditAboutMeDetails()
{
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"	)
	{
		if(xmlHttp.responseText != '')
		{
			alert('profile successfully updated');
			viewMyProfile('');
			closeBox();
		}
	}
}


function showallsweetfriends(pagewithpath)
{
	var loading="<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" class=\"marginbottom5 fontbold\" height=\"500\"><tr><td valign=\"top\" align=\"left\" class=\"gap10\">&nbsp;</td></tr><tr><td valign=\"top\" align=\"left\" class=\"gap10\">&nbsp;</td></tr><tr><td valign=\"middle\" align=\"center\"><img src=\"images/loader.gif\" border=0></td></tr><tr><td valign=\"top\" align=\"left\" class=\"gap10\">&nbsp;</td></tr><tr><td valign=\"top\" align=\"left\" class=\"gap10\">&nbsp;</td></tr></table>";
	document.getElementById("albumcovers").innerHTML = loading; 
	var path=pagewithpath;
	var url=path;
	url=url+"&sid="+Math.random()
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	{
		alert ("Browser does not support HTTP Request")
		return
	} 
	xmlHttp.onreadystatechange=onshowallsweetfriends
	xmlHttp.open("GET",url,true) 
	xmlHttp.send(null) 
}

function onshowallsweetfriends()
{
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"	)
	{
		if(xmlHttp.responseText != '')
		{
			document.getElementById("albumcovers").innerHTML = xmlHttp.responseText 
		}
	}
}

function reloadCaptcha() {
	now = new Date();
	var capObj = document.getElementById('spam_code_img');
	if (capObj) {
		capObj.src = capObj.src + (capObj.src.indexOf('?') > -1 ? '&' : '?') + Math.ceil(Math.random()*(now.getTime()));
		
	}
}


function validateRegbox()
{
	
	var message = 0 ;
	var username=document.getElementById('username1').value;
	if(username=="")
	{
		
		document.getElementById("spanusername1").innerHTML ='Please specify a username.' 
		document.getElementById('username2').className="redcolor"
		document.getElementById('username1').className="registerinputs redborder";
		document.getElementById('username1').focus();
		message++  
		//return false;
	}else
	{
		document.getElementById('username2').className="blackcolor"
		document.getElementById('username1').className="registerinputs";
		document.getElementById("spanusername1").innerHTML ='' 
	}
	var email=document.getElementById('email1').value;
	if(email=="")
	{
		
		document.getElementById("spanemail1").innerHTML ='Please specify a email-id!'
		document.getElementById('email2').className="redcolor"
		document.getElementById('email1').className="registerinputs redborder";
		document.getElementById('email1').focus();
		message++ 
	}
	else
	{
		
		if( ! echeck(email) )
		{
			document.getElementById("spanemail1").innerHTML ='Please specify valid email-id!'
			document.getElementById('email2').className="redcolor"
			document.getElementById('email1').className="registerinputs redborder";
			document.getElementById('email1').focus();
			message++ 
		
		}else{
		document.getElementById('email2').className="blackcolor"
		document.getElementById('email1').className="registerinputs";
		document.getElementById("spanemail1").innerHTML =''
		}
	}
	var password=document.getElementById('mypassword').value;
	if(password=="")
	{
		
		document.getElementById("spanpassword1").innerHTML ='Please specify a password!'
		document.getElementById('password2').className="redcolor"
		document.getElementById('mypassword').className="registerinputs redborder";
		document.getElementById('mypassword').focus();
		message++ 
		//return false;
	}
	else
	{
		document.getElementById('password2').className="blackcolor"
		document.getElementById('mypassword').className="registerinputs";
		document.getElementById("spanpassword1").innerHTML =''
	}
	var c_password=document.getElementById('c_password1').value;
	if(c_password=="")
	{
		
		document.getElementById("spanc_password1").innerHTML ='Please specify a confirm password!'
		document.getElementById('c_password2').className="redcolor"
		document.getElementById('c_password1').className="registerinputs redborder";
		document.getElementById('c_password1').focus();
		message++ 
		
	}else{
	if( password != c_password  )
		{
			document.getElementById("spanc_password1").innerHTML ='Your passwords entries do not match.'
			document.getElementById('c_password2').className="redcolor"
			document.getElementById('c_password1').className="registerinputs redborder";
		document.getElementById('c_password1').focus();
		message++ 
		}
		else
		{
		document.getElementById('c_password2').className="blackcolor"
		document.getElementById('c_password1').className="registerinputs";
		document.getElementById("spanc_password1").innerHTML =''
		}
	}
	
	var day=document.getElementById('day').value;
	var month=document.getElementById('month').value;
	var year=document.getElementById('year').value;
	if( (day=="-1" && month=="-1" && year =='-1') || (day=="-1" && month=="-1") ||(month=="-1" && year=="-1") || (day=="-1" && year=="-1") )
	{
		
		document.getElementById("spandob1").innerHTML ='Please select day,month and year.' 
		document.getElementById('dob2').className="redcolor"
		document.getElementById('day').className="selecttypes redborder";
		document.getElementById('year').className="selecttypes redborder";
		document.getElementById('month').className="selecttypes redborder";
		document.getElementById('day').focus();
		message++  
		
	}else if(day=="-1") 
	{
		document.getElementById("spandob1").innerHTML ='Please select a day.' 
		document.getElementById('dob2').className="redcolor"
		document.getElementById('day').className="selecttypes redborder";
		document.getElementById('month').className="selecttypes";
		document.getElementById('year').className="selecttypes";
		document.getElementById('day').focus();
		message++  
	}else if(month=="-1")
	{
		document.getElementById("spandob1").innerHTML ='Please select a month.' 
		document.getElementById('dob2').className="redcolor"
		document.getElementById('month').className="selecttypes redborder";
		document.getElementById('day').className="selecttypes";
		document.getElementById('year').className="selecttypes";
		document.getElementById('month').focus();
		message++  
		
	}
	else if(year=="-1")
	{
		document.getElementById("spandob1").innerHTML ='Please select a year.' 
		document.getElementById('dob2').className="redcolor"
		document.getElementById('year').className="selecttypes redborder";
		document.getElementById('day').className="selecttypes";
		document.getElementById('month').className="selecttypes";
		document.getElementById('year').focus();
		message++  
		
	}
	else 
	{
		document.getElementById('dob2').className="blackcolor"
		document.getElementById('day').className="selecttypes";
		document.getElementById('month').className="selecttypes";
		document.getElementById('year').className="selecttypes";
		document.getElementById("spandob1").innerHTML ='' 
	}
	
	if(!(document.getElementById('terms1').checked))
	{
		document.getElementById("spanterms1").innerHTML ='Please accept terms and conditions!'
		message++ 
		
	}else
	{
		document.getElementById("spanterms1").innerHTML =''
	}

	if(message!=0)
	{
		document.getElementById("spanerror").innerHTML ='<table align="center"><tr><td><img src="images/agt_stop1.png" border="0" /></td><td>'+message +' Error(s) occured while validating your form.</td></table>'
		return false;
	}else
	{
			document.getElementById("spanerror").innerHTML =''
			return true;
	}
	
}

function echeck(str)
{
	var at="@"
	var dot="."
	var lat=str.indexOf(at)
	var lstr=str.length
	var ldot=str.indexOf(dot)
	if (str.indexOf(at)==-1)
	{
		return false
	}
	
	if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr)
	{
		return false
	}
	
	if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr)
	{
		return false
	}
	if (str.indexOf(at,(lat+1))!=-1)
	{
		return false
	}	
	if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot)
	{
		return false
	}	
	if (str.indexOf(dot,(lat+2))==-1)
	{
		return false
	}
	if (str.indexOf(" ")!=-1)
	{
		return false
	}
	return true
}

function validateinfobox()
{
var message = 0 ;
var f_name=document.getElementById('f_name').value;
if(f_name=="")
{

document.getElementById("spanf_name").innerHTML ='Please specify first name.'
document.getElementById('f_name2').className="redcolor"
document.getElementById('f_name').className="registerinputs redborder";
document.getElementById('f_name').focus();

message++

}else
{
document.getElementById('f_name2').className="blackcolor"
document.getElementById('f_name').className="registerinputs";
document.getElementById("spanf_name").innerHTML =''
}

var sign=document.getElementById('sign').value;
if(sign==-1)
{

document.getElementById("spansign").innerHTML ='Please select your zodiac sign.'
document.getElementById('sign2').className="redcolor"
document.getElementById('sign').className="inputtypetext redborder";
document.getElementById('userzip').focus();
message++
}else
{
document.getElementById('sign2').className="blackcolor"
document.getElementById('sign').className="inputtypetext";
document.getElementById("spansign").innerHTML =''
}


var userzip=document.getElementById('userzip').value;
if(userzip=="")
{

document.getElementById("spanuserzip").innerHTML ='Please specify a zip code.'
document.getElementById('userzip2').className="redcolor"
document.getElementById('userzip').className="registerinputs redborder";
document.getElementById('userzip').focus();
message++
}else
{
document.getElementById('userzip2').className="blackcolor"
document.getElementById('userzip').className="registerinputs";
document.getElementById("spanuserzip").innerHTML =''
}
var usercountry=document.getElementById('country').value;
if(usercountry=="-1" || usercountry=="")
{

document.getElementById("spanusercountry").innerHTML ='Please specify a country.'
document.getElementById('usercountry2').className="redcolor"
document.getElementById('country').className="inputtypetextforright redborder";
document.getElementById('country').focus();
message++
}else
{
document.getElementById('usercountry2').className="blackcolor"
document.getElementById('country').className="inputtypetextforright";
document.getElementById("spanusercountry").innerHTML =''
}

var usersate=document.getElementById('state').value;
if(usersate=="-1")
{
var othersstates=document.getElementById('otherstate').value;
if(othersstates=="")
{
document.getElementById("spanstateerror").innerHTML ='Please specify a state.'
document.getElementById('userstate2').className="redcolor"
document.getElementById('state').className="inputtypetextforright redborder";
document.getElementById('state').focus();
message++
}
}else
{
document.getElementById('userstate2').className="blackcolor"
document.getElementById('state').className="inputtypetextforright";
document.getElementById("spanstateerror").innerHTML =''
}

var usercity=document.getElementById('city').value;
if(usercity=="-1")
{
var othercity=document.getElementById('othercity').value;
if(othercity=="")
{
document.getElementById("spancityerror").innerHTML ='Please specify a city.'
document.getElementById('usercity2').className="redcolor"
document.getElementById('city').className="inputtypetextforright redborder";
document.getElementById('city').focus();
message++
}
}else
{
document.getElementById('usercity2').className="blackcolor"
document.getElementById('city').className="inputtypetextforright";
document.getElementById("spancityerror").innerHTML =''
}
var sexualorientation=document.getElementById('sexualorientation').value;
if(sexualorientation=="")
{

document.getElementById("spansexualorientation").innerHTML ='Please Choose Sexual Orientation.'
document.getElementById('ssexualorientation').className="redcolor"
document.getElementById('sexualorientation').className="inputtypetextforright redborder";
document.getElementById('sexualorientation').focus();
message++
}else
{
document.getElementById('sexualorientation').className="blackcolor"
document.getElementById('sexualorientation').className="inputtypetextforright";
document.getElementById("spansexualorientation").innerHTML =''
}
var relationshiptype=document.getElementById('relationshiptype').value;
if(relationshiptype=="")
{

document.getElementById("spanrelationshiptype").innerHTML ='Please Choose Relationship Type.'
document.getElementById('srelationshiptype').className="redcolor"
document.getElementById('relationshiptype').className="inputtypetextforright redborder";
document.getElementById('relationshiptype').focus();
message++
}else
{
document.getElementById('relationshiptype').className="blackcolor"
document.getElementById('relationshiptype').className="inputtypetextforright";
document.getElementById("spanrelationshiptype").innerHTML =''
}

var mystory=document.getElementById('mystory').value;
if(mystory=="")
{
document.getElementById("spanmystory").innerHTML ='Please Enter My Story.'
document.getElementById('smystory').className="redcolor"
document.getElementById('mystory').className="registerinputstxtarea redborder";
document.getElementById('mystory').focus();
message++
}else
{
document.getElementById('smystory').className="blackcolor"
document.getElementById('mystory').className="registerinputstxtarea";
document.getElementById("mystory").focus();
}

var Ethnicity=document.getElementById('Ethnicity').value;
if(Ethnicity=="")
{

document.getElementById("spanethnicity").innerHTML ='Please Choose Ethnicity.'
document.getElementById('sethnicity').className="redcolor"
document.getElementById('Ethnicity').className="inputtypetextforright redborder";
document.getElementById('Ethnicity').focus();
message++
}else
{
document.getElementById('Ethnicity').className="blackcolor"
document.getElementById('Ethnicity').className="inputtypetextforright";
document.getElementById("spanethnicity").innerHTML =''
}
var Bodytype=document.getElementById('Bodytype').value;
if(Bodytype=="")
{

document.getElementById("spanbodytype").innerHTML ='Please Choose BodyType.'
document.getElementById('sBodytype').className="redcolor"
document.getElementById('Bodytype').className="inputtypetextforright redborder";
document.getElementById('Bodytype').focus();
message++
}else
{
document.getElementById('Bodytype').className="blackcolor"
document.getElementById('Bodytype').className="inputtypetextforright";
document.getElementById("spanbodytype").innerHTML =''
}
var Height=document.getElementById('Height').value;
if(Height=="")
{

document.getElementById("spanheight").innerHTML ='Please Choose Height.'
document.getElementById('sHeight').className="redcolor"
document.getElementById('Height').className="inputtypetextforright redborder";
document.getElementById('Height').focus();
message++
}else
{
document.getElementById('Height').className="blackcolor"
document.getElementById('Height').className="inputtypetextforright";
document.getElementById("spanheight").innerHTML =''
}
var Haircolor=document.getElementById('Haircolor').value;
if(Haircolor=="")
{

document.getElementById("spanhaircolor").innerHTML ='Please Choose HairColor.'
document.getElementById('sHaircolor').className="redcolor"
document.getElementById('Haircolor').className="inputtypetextforright redborder";
document.getElementById('Haircolor').focus();
message++
}else
{
document.getElementById('Haircolor').className="blackcolor"
document.getElementById('Haircolor').className="inputtypetextforright";
document.getElementById("spanhaircolor").innerHTML =''
}
var EyeColor=document.getElementById('EyeColor').value;
if(EyeColor=="")
{

document.getElementById("spaneyecolor").innerHTML ='Please Choose EyeColor.'
document.getElementById('sEyeColor').className="redcolor"
document.getElementById('EyeColor').className="inputtypetextforright redborder";
document.getElementById('EyeColor').focus();
message++
}else
{
document.getElementById('EyeColor').className="blackcolor"
document.getElementById('EyeColor').className="inputtypetextforright";
document.getElementById("spaneyecolor").innerHTML =''
}
var relationshipstatus=document.getElementById('relationshipstatus').value;
if(relationshipstatus=="")
{

document.getElementById("spanrelationshipstatus").innerHTML ='Please Choose RelationShipStatus.'
document.getElementById('srelationshipstatus').className="redcolor"
document.getElementById('relationshipstatus').className="inputtypetextforright redborder";
document.getElementById('relationshipstatus').focus();
message++
}else
{
document.getElementById('relationshipstatus').className="blackcolor"
document.getElementById('relationshipstatus').className="inputtypetextforright";
document.getElementById("spanrelationshipstatus").innerHTML =''
}
var Children=document.getElementById('Children').value;
if(Children=="")
{

document.getElementById("spanchildren").innerHTML ='Please Choose Children.'
document.getElementById('sChildren').className="redcolor"
document.getElementById('Children').className="inputtypetextforright redborder";
document.getElementById('Children').focus();
message++
}else
{
document.getElementById('Children').className="blackcolor"
document.getElementById('Children').className="inputtypetextforright";
document.getElementById("spanchildren").innerHTML =''
}
var smoke=document.getElementById('smoke').value;
if(smoke=="")
{

document.getElementById("spansmoke").innerHTML ='Please Choose Smoke.'
document.getElementById('ssmoke').className="redcolor"
document.getElementById('smoke').className="inputtypetextforright redborder";
document.getElementById('smoke').focus();
message++
}else
{
document.getElementById('smoke').className="blackcolor"
document.getElementById('smoke').className="inputtypetextforright";
document.getElementById("spansmoke").innerHTML =''
}
var drink=document.getElementById('drink').value;
if(drink=="")
{

document.getElementById("spandrink").innerHTML ='Please Choose Drink.'
document.getElementById('sdrink').className="redcolor"
document.getElementById('drink').className="inputtypetextforright redborder";
document.getElementById('drink').focus();
message++
}else
{
document.getElementById('drink').className="blackcolor"
document.getElementById('drink').className="inputtypetextforright";
document.getElementById("spandrink").innerHTML =''
}

var educationlevel=document.getElementById('educationlevel').value;
if(educationlevel=="")
{

document.getElementById("spaneducationlevel").innerHTML ='Please Choose EducationLevel.'
document.getElementById('seducationlevel').className="redcolor"
document.getElementById('educationlevel').className="inputtypetextforright redborder";
document.getElementById('educationlevel').focus();
message++
}else
{
document.getElementById('educationlevel').className="blackcolor"
document.getElementById('educationlevel').className="inputtypetextforright";
document.getElementById("spaneducationlevel").innerHTML =''
}
var profession=document.getElementById('profession').value;
if(profession=="")
{

document.getElementById("spanprofession").innerHTML ='Please specify Profession.'
document.getElementById('sprofession').className="redcolor"
document.getElementById('profession').className="registerinputs redborder";
document.getElementById('profession').focus();

message++

}else
{
document.getElementById('sprofession').className="blackcolor"
document.getElementById('profession').className="registerinputs";
document.getElementById("spanprofession").innerHTML =''
}
var religion=document.getElementById('religion').value;
if(religion=="")
{

document.getElementById("spanreligion").innerHTML ='Please Choose Religion.'
document.getElementById('sreligion').className="redcolor"
document.getElementById('religion').className="inputtypetextforright redborder";
document.getElementById('religion').focus();
message++
}else
{
document.getElementById('religion').className="blackcolor"
document.getElementById('religion').className="inputtypetextforright";
document.getElementById("spanreligion").innerHTML =''
}
var growingup=document.getElementById('growingup').value;
if(growingup=="")
{

document.getElementById("spangrowingup").innerHTML ='Please Choose GrowingUp I was.'
document.getElementById('sgrowingup').className="redcolor"
document.getElementById('growingup').className="inputtypetextforright redborder";
document.getElementById('growingup').focus();
message++
}else
{
document.getElementById('growingup').className="blackcolor"
document.getElementById('growingup').className="inputtypetextforright";
document.getElementById("spangrowingup").innerHTML =''
}
var incomelevel=document.getElementById('incomelevel').value;
if(incomelevel=="")
{

document.getElementById("spanincomelevel").innerHTML ='Please Choose IncomeLevel.'
document.getElementById('sincomelevel').className="redcolor"
document.getElementById('incomelevel').className="inputtypetextforright redborder";
document.getElementById('incomelevel').focus();
message++
}else
{
document.getElementById('incomelevel').className="blackcolor"
document.getElementById('incomelevel').className="inputtypetextforright";
document.getElementById("spanincomelevel").innerHTML =''
}
var personality=document.getElementById('personality').value;
if(personality=="")
{

document.getElementById("spanpersonality").innerHTML ='Please Choose Personality.'
document.getElementById('spersonality').className="redcolor"
document.getElementById('personality').className="inputtypetextforright redborder";
document.getElementById('personality').focus();
message++
}else
{
document.getElementById('personality').className="blackcolor"
document.getElementById('personality').className="inputtypetextforright";
document.getElementById("spanpersonality").innerHTML =''
}
var myfriendthink=document.getElementById('myfriendthink').value;
if(myfriendthink=="")
{

document.getElementById("spanmyfriendthink").innerHTML ='Please Choose My Friend Think.'
document.getElementById('smyfriendthink').className="redcolor"
document.getElementById('myfriendthink').className="inputtypetextforright redborder";
document.getElementById('myfriendthink').focus();
message++
}else
{
document.getElementById('myfriendthink').className="blackcolor"
document.getElementById('myfriendthink').className="inputtypetextforright";
document.getElementById("spanmyfriendthink").innerHTML =''
}
var Sex=document.getElementById('Sex').value;
if(Sex=="")
{

document.getElementById("spanSex").innerHTML ='Please Choose Sex.'
document.getElementById('sSex').className="redcolor"
document.getElementById('Sex').className="inputtypetextforright redborder";
document.getElementById('Sex').focus();
message++
}else
{
document.getElementById('Sex').className="blackcolor"
document.getElementById('Sex').className="inputtypetextforright";
document.getElementById("spanSex").innerHTML =''
}
var Athethic=document.getElementById('Athethic').value;
if(Athethic=="")
{

document.getElementById("spanAthethic").innerHTML ='Please Choose Athethic.'
document.getElementById('sAthethic').className="redcolor"
document.getElementById('Athethic').className="inputtypetextforright redborder";
document.getElementById('Athethic').focus();
message++
}else
{
document.getElementById('Athethic').className="blackcolor"
document.getElementById('Athethic').className="inputtypetextforright";
document.getElementById("spanAthethic").innerHTML =''
}
var lastplacevisited=document.getElementById('lastplacevisited').value;
if(lastplacevisited=="")
{

document.getElementById("spanlastplacevisited").innerHTML ='Please specify Last Place Visited.'
document.getElementById('slastplacevisited').className="redcolor"
document.getElementById('lastplacevisited').className="registerinputs redborder";
document.getElementById('lastplacevisited').focus();

message++

}else
{
document.getElementById('lastplacevisited').className="blackcolor"
document.getElementById('lastplacevisited').className="registerinputs";
document.getElementById("spanlastplacevisited").innerHTML =''
}
var lastbookread=document.getElementById('lastbookread').value;
if(lastbookread=="")
{

document.getElementById('spanlastbookread').innerHTML ='Please specify Last Book Read.'
document.getElementById('slastbookread').className="redcolor"
document.getElementById('lastbookread').className="registerinputs redborder";
document.getElementById('lastbookread').focus();

message++

}else
{
document.getElementById('lastbookread').className="blackcolor"
document.getElementById('lastbookread').className="registerinputs";
document.getElementById("spanlastbookread").innerHTML =''
}
var lastmusiccd=document.getElementById('lastmusiccd').value;
if(lastmusiccd=="")
{

document.getElementById('spanlastmusiccd').innerHTML ='Please specify Last Music CD I Purchased.'
document.getElementById('slastmusiccd').className="redcolor"
document.getElementById('lastmusiccd').className="registerinputs redborder";
document.getElementById('lastmusiccd').focus();

message++

}else
{
document.getElementById('lastmusiccd').className="blackcolor"
document.getElementById('lastmusiccd').className="registerinputs";
document.getElementById("spanlastmusiccd").innerHTML =''
}
var Iseemyselfas=document.getElementById('Iseemyselfas').value;
if(Iseemyselfas=="")
{
document.getElementById("spanIseemyselfas").innerHTML ='Please specify I see myself as.'
document.getElementById('sIseemyselfas').className="redcolor"
document.getElementById('Iseemyselfas').className="registerinputstxtarea redborder";
document.getElementById('Iseemyselfas').focus();
message++
}else
{
document.getElementById('sIseemyselfas').className="blackcolor"
document.getElementById('Iseemyselfas').className="registerinputstxtarea";
document.getElementById("spanIseemyselfas").innerHTML =''
}
var this_point_mylife=document.getElementById('this_point_mylife').value;
if(this_point_mylife=="")
{
document.getElementById("spanthis_point_mylife").innerHTML ='Please specify at this point Iam'
document.getElementById('sthis_point_mylife').className="redcolor"
document.getElementById('this_point_mylife').className="registerinputstxtarea redborder";
document.getElementById('this_point_mylife').focus();
message++
}else
{
document.getElementById('sthis_point_mylife').className="blackcolor"
document.getElementById('this_point_mylife').className="registerinputstxtarea";
document.getElementById("spanthis_point_mylife").innerHTML =''
}
var highestpointmylife=document.getElementById('highestpointmylife').value;
if(highestpointmylife=="")
{
document.getElementById("spanhighestpointmylife").innerHTML ='Please specify the highest Point in my life will be.'
document.getElementById('shighestpointmylife').className="redcolor"
document.getElementById('highestpointmylife').className="registerinputstxtarea redborder";
document.getElementById('highestpointmylife').focus();
message++

}else
{
document.getElementById('shighestpointmylife').className="blackcolor"
document.getElementById('highestpointmylife').className="registerinputstxtarea";
document.getElementById('spanhighestpointmylife').innerHTML =''
}
var Aperfectdateforme=document.getElementById('Aperfectdateforme').value;
if(Aperfectdateforme=="")
{
document.getElementById("spanAperfectdateforme").innerHTML ='Please specify A perfect first Date for me.'
document.getElementById('sAperfectdateforme').className="redcolor"
document.getElementById('Aperfectdateforme').className="registerinputstxtarea redborder";
document.getElementById('Aperfectdateforme').focus();
message++

}else
{
document.getElementById('sAperfectdateforme').className="blackcolor"
document.getElementById('Aperfectdateforme').className="registerinputstxtarea";
document.getElementById("spanAperfectdateforme").innerHTML =''
}
var Avgsun=document.getElementById('Avgsun').value;
if(Avgsun=="")
{
document.getElementById("spanAvgsun").innerHTML ='Please specify A perfect first Date for me.'
document.getElementById('sAvgsun').className="redcolor"
document.getElementById('Avgsun').className="registerinputs redborder";
document.getElementById('Avgsun').focus();
message++

}else
{
document.getElementById('sAvgsun').className="blackcolor"
document.getElementById('Avgsun').className="registerinputs";
document.getElementById("spanAvgsun").innerHTML ='';
}
var interest=document.getElementById('interest').value;
if(interest=="")
{
document.getElementById("spaninterest").innerHTML ='Please specify your interests.'
document.getElementById('interest2').className="redcolor"
document.getElementById('interest').className="inputtypetextforright redborder";
document.getElementById('interest').focus();
message++
	
		//return false;
	}else
	{
		document.getElementById('interest2').className="blackcolor"
		document.getElementById('interest').className="inputtypetextforright";
		document.getElementById("interest").innerHTML ='' 
	}
	
	var aboutme=document.getElementById('aboutme').value;
	
	if(aboutme=="")
	{
		document.getElementById("spanaboutme").innerHTML ='Please Enter About You.' 
		document.getElementById('aboutme2').className="redcolor"
		document.getElementById('aboutme').className="registerinputstxtarea redborder";
		document.getElementById('aboutme').focus();
		message++
	
	}else
	{
		document.getElementById('aboutme2').className="blackcolor"
		document.getElementById('aboutme').className="registerinputstxtarea";
		document.getElementById("aboutme").focus(); 
	}
	
	
	if(!(document.getElementById('terms4').checked))
	{
		document.getElementById("spanterms4").innerHTML ='Please accept terms and conditions!'
		document.getElementById('terms4').focus();
		message++ 
		
	}else
	{
		document.getElementById("spanterms4").innerHTML =''
	}
	
	if(message!=0)
	{
		return false	
	}

}



function validateinfobox2()
{
	var message = 0 ;
	var f_name=document.getElementById('f_name').value;

	if(f_name=="")
	{
		
		document.getElementById("spanf_name").innerHTML ='Please specify first name.' 
		document.getElementById('f_name2').className="redcolor"
		document.getElementById('f_name').className="registerinputs redborder";
		document.getElementById('f_name').focus();
		
		message++
		
	}else
	{
		document.getElementById('f_name2').className="blackcolor"
		document.getElementById('f_name').className="registerinputs";
		document.getElementById("spanf_name").innerHTML ='' 
	}
	
	
	var userzip=document.getElementById('userzip').value;
	if(userzip=="")
	{
		
		document.getElementById("spanuserzip").innerHTML ='Please specify a zip code.' 
		document.getElementById('userzip2').className="redcolor"
		document.getElementById('userzip').className="registerinputs redborder";
		document.getElementById('userzip').focus();
		message++  
	}else
	{
		document.getElementById('userzip2').className="blackcolor"
		document.getElementById('userzip').className="registerinputs";
		document.getElementById("spanuserzip").innerHTML ='' 
	}
	var usercountry=document.getElementById('country').value;
	if(usercountry=="-1" || usercountry=="")
	{
		
		document.getElementById("spanusercountry").innerHTML ='Please specify a country.' 
		document.getElementById('usercountry2').className="redcolor"
		document.getElementById('country').className="inputtypetextforright redborder";
		document.getElementById('country').focus();
		message++  
	}else
	{
		document.getElementById('usercountry2').className="blackcolor"
		document.getElementById('country').className="inputtypetextforright";
		document.getElementById("spanusercountry").innerHTML ='' 
	}
	
	var usersate=document.getElementById('state').value;
	if(usersate=="-1")
	{
		var othersstates=document.getElementById('otherstate').value;
		if(othersstates=="")
		{
			document.getElementById("spanstateerror").innerHTML ='Please specify a state.' 
			document.getElementById('userstate2').className="redcolor"
			document.getElementById('state').className="inputtypetextforright redborder";
			document.getElementById('state').focus();
			message++  
		}
	}else
	{
		document.getElementById('userstate2').className="blackcolor"
		document.getElementById('state').className="inputtypetextforright";
		document.getElementById("spanstateerror").innerHTML ='' 
	}

	var usercity=document.getElementById('city').value;
	if(usercity=="-1")
	{
		var othercity=document.getElementById('othercity').value;
		if(othercity=="")
		{
			document.getElementById("spancityerror").innerHTML ='Please specify a city.' 
			document.getElementById('usercity2').className="redcolor"
			document.getElementById('city').className="inputtypetextforright redborder";
			document.getElementById('city').focus();
			message++  
		}
	}else
	{
		document.getElementById('usercity2').className="blackcolor"
		document.getElementById('city').className="inputtypetextforright";
		document.getElementById("spancityerror").innerHTML ='' 
	}

	var interest=document.getElementById('interest').value;
	if(interest=="")
	{
		document.getElementById("spaninterest").innerHTML ='Please specify your interests.' 
		document.getElementById('interest2').className="redcolor"
		document.getElementById('interest').className="inputtypetextforright redborder";
		document.getElementById('interest').focus();
		message++
	}else
	{
		document.getElementById('interest2').className="blackcolor"
		document.getElementById('interest').className="inputtypetextforright";
		document.getElementById("interest").innerHTML ='' 
	}
	
	var aboutme=document.getElementById('aboutme').value;
	if(aboutme=="")
	{
		document.getElementById("spanaboutme").innerHTML ='Please specify your interests.' 
		document.getElementById('aboutme2').className="redcolor"
		document.getElementById('aboutme').className="registerinputstxtarea redborder";
		document.getElementById('aboutme').focus();
		message++
	}else
	{
		document.getElementById('aboutme2').className="blackcolor"
		document.getElementById('aboutme').className="registerinputstxtarea";
		document.getElementById("aboutme").focus(); 
	}
	
	
	if(!(document.getElementById('terms4').checked))
	{
		document.getElementById("spanterms4").innerHTML ='Please accept terms and conditions!'
		document.getElementById('terms4').focus();
		message++ 
		
	}else
	{
		document.getElementById("spanterms4").innerHTML =''
	}
	
	if(message!=0)
	{
		return false	
	}

}

var seconds=1000;
var chkmailsec=1000;
checkLogin();

function checkLogin()
{
	var path="function.php?checkLog=yes";
	var url=path;
	url=url+"&sid="+Math.random()
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	{
		alert ("Browser does not support HTTP Request")
		return
	} 
	xmlHttp.onreadystatechange=oncheckLogin
	xmlHttp.open("GET",url,true) 
	xmlHttp.send(null) 
} 

function oncheckLogin()
{
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"	)
	{
		if(xmlHttp.responseText != '')
		{
			setTimeout("checkLogin()",600000);	
		}
	}
}

/*function startAllFunctions()
{
	checkUpdates();
}

function checkUpdates()
{
	document.getElementById('mesgcontainer').style.display="none";
	var url="view/notification.php?checknotmail=yes";
	url=url+"&sid="+Math.random()
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	{
		alert ("Browser does not support HTTP Request")
		return
	} 
	xmlHttp.onreadystatechange=oncheckUpdates
	xmlHttp.open("GET",url,true) 
	xmlHttp.send(null) 
} 

function oncheckUpdates()
{
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"	)
	{
		if(xmlHttp.responseText != '0')
		{
			document.getElementById('mesgcontainer').style.display="block";
			document.getElementById('vam').innerHTML=xmlHttp.responseText;
		}
			setTimeout("checkUpdates()",15000);	
	}
}

*/function closeDiv()
{
	document.getElementById('mesgcontainer').style.display="none";
}

function deleteRecActt(recid,userid,startlimit)
{
	x=confirm("Are u sure you want to delete it ?");
	if(x)
	{
		var url="controller/postComment.php?deleteRecAcc=yes&recid="+recid+"&userid="+userid+"&startlimit="+startlimit;
		url=url+"&sid="+Math.random()
		xmlHttp=GetXmlHttpObject()
		if (xmlHttp==null)
		{
			alert ("Browser does not support HTTP Request")
			return
		} 
		xmlHttp.onreadystatechange=ondeleteRecActt
		xmlHttp.open("GET",url,true) 
		xmlHttp.send(null) 
	}
	else
	{
		return false;
	}
} 

function ondeleteRecActt()
{
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"	)
	{
		if(xmlHttp.responseText != '')
		{
/*			var dat=xmlHttp.responseText.split('~');
			var path="function.php?showmyRecentAct=yes&userid="+dat[0]+"&startlimit="+dat[1];
			showrecentactivity(path)
*/
			location.href="index.php?page=9";
		}
	}
}

function reportInappropriate(type,typesid)
{
		var url="controller/inviteFriends.php?reportFlag=yes&type="+type+"&typesid="+typesid;
		url=url+"&sid="+Math.random()
		xmlHttp=GetXmlHttpObject()
		if (xmlHttp==null)
		{
			alert ("Browser does not support HTTP Request")
			return
		} 
		xmlHttp.onreadystatechange=onreportInappropriate
		xmlHttp.open("GET",url,true) 
		xmlHttp.send(null) 
}

function onreportInappropriate()
{
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"	)
	{
		if(xmlHttp.responseText != '')
		{
			document.getElementById("commenterror").innerHTML = "Flagged as inappropriate successfully." 
		}
	}
}
function validateUploadvideo()
{
	var videoname=document.addvideos.videoname.value;
	var videopath=document.addvideos.videopath.value;
	var description=document.addvideos.description.value;
	var status=document.addvideos.status.value;
	
	if(videoname=="")
	{
		alert("Please Enter Video Name");
		document.addvideos.videoname.focus();
		return(false);
	}
	if(videopath=="")
	{
		alert("Please Enter Video Path");
		document.addvideos.videopath.focus();
		return(false);
	}
	if(description=="")
	{
		alert("Please Enter Description");
		document.addvideos.description.focus();
		return(false);
	}
	if(!document.addvideos.status.checked)
	{
	 alert("Please Tick Mark the Checkbox");
		document.addvideos.status.focus();
		return(false);	
	}
	
}

function showVideoDesc(videoid)
{
	var dis=document.getElementById('vv'+videoid).style.display;
	if(dis=="block")
	{
		document.getElementById('vv'+videoid).style.display="none";
	}
	else
	{
		document.getElementById('vv'+videoid).style.display="block";
	}
}

function submitVideoDisplayForm(startlimit)
{
	
	document.getElementById('startlimit').value=startlimit;
	document.videodisplay.submit();
}

function deleteThisRc(recordid)
{
	x=confirm("Aru you sure you want to delete it ?");
	if(x)
	{
		var url="controller/inviteFriends.php?deleteAdmirersRec=yes&recordid="+recordid;
		url=url+"&sid="+Math.random()
		xmlHttp=GetXmlHttpObject()
		if (xmlHttp==null)
		{
			alert ("Browser does not support HTTP Request")
			return
		} 
		xmlHttp.onreadystatechange=ondeleteThisRc
		xmlHttp.open("GET",url,true) 
		xmlHttp.send(null) 
	}
	else
	{
		return false;
	}
}

function ondeleteThisRc()
{
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"	)
	{
		if(xmlHttp.responseText != '')
		{
			location.href="index.php?page=21";
		}
	}
}

function sendMailForShare()
{
	var toemail=document.getElementById('toemail').value;
	var subject=document.getElementById('subject').value;
	var message=document.getElementById('message').value;
	var sharetype=document.getElementById('sharetype').value;;
	var sharepath=document.getElementById('sharepath').value;;
	var toemail2=document.getElementById('toemail2').value;
	var emtot=0;
	if(toemail=="")
	{
		document.getElementById('toemail').focus();
		emtot++;
	}
	
	if(toemail2=="")
	{
		document.getElementById('toemail2').focus();
		emtot++;
	}
	
	if(emtot>1)
	{
		alert('Please specify either emailid or usernames seperated by comma like ","')
		return false;
	}
	

	if(subject=="")
	{
		alert("Please enter the subject ");
		document.getElementById('subject').focus();
		return false;
	}

	if(message=="")
	{
		alert("Please enter some message");
		document.getElementById('message').focus();
		return false;
	}
	
	var path="controller/postComment.php?shareinmail=yes&toemail="+toemail+"&email2="+toemail2+"&subject="+subject+"&message="+message+"&sharetype="+sharetype+"&sharepath="+sharepath;
	var url=path;
	url=url+"&sid="+Math.random()
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	{
		alert ("Browser does not support HTTP Request")
		return
	} 
	xmlHttp.onreadystatechange=onsendMailForShare
	xmlHttp.open("GET",url,true) 
	xmlHttp.send(null) 
}

function onsendMailForShare()
{
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"	)
	{
		if(xmlHttp.responseText != '')
		{
			location.href="index.php?page=15";
		}
	}
}

function moveFreind(userid,friendid,page,type)
{
	var path="controller/friendsRequest.php?movefriends=yes&userid="+userid+"&friendid="+friendid+"&page="+page+"&type="+type;
	var url=path;
	url=url+"&sid="+Math.random()
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	{
		alert ("Browser does not support HTTP Request")
		return
	} 
	xmlHttp.onreadystatechange=onmoveFreind
	xmlHttp.open("GET",url,true) 
	xmlHttp.send(null) 
}

function onmoveFreind()
{
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"	)
	{
		if(xmlHttp.responseText != '')
		{
			closeBox();
			var val=xmlHttp.responseText.split('~');
			
			location.href="index.php?page="+val[0]+"&generalid="+val[1];
		}
	}
}

function directToYoutube()
{
	window.location.href="https://www.google.com/accounts/AuthSubRequest?next=http://localhost/sweetluck/operations.php&scope=http://gdata.youtube.com&secure=&session=1";
}

function addYoutubeVideo(userid,videoval)
{
	var path="operations.php?addYoutubeVideo=yes&userid="+userid+"&videoId="+videoval;
	var url=path;
	url=url+"&sid="+Math.random()
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	{
		alert ("Browser does not support HTTP Request")
		return
	} 
	xmlHttp.onreadystatechange=onaddYoutubeVideo
	xmlHttp.open("GET",url,true) 
	xmlHttp.send(null) 
}

function onaddYoutubeVideo()
{
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"	)
	{
		if(xmlHttp.responseText != '')
		{
			closeBox();
			var val=xmlHttp.responseText.split('~');
			
			location.href="index.php?page=15";
		}
	}
}

function firstdatestory(no)
{
	var divname="firstddatestory"+no;
	
	document.getElementById(divname).style.display='';
	if(no==1)
	{
	document.getElementById(fd1).style.display='none';
	
	}
	if(no==2)
	{
	document.getElementById(fd2).style.display='none';
	}
	if(no==3)
	{
	document.getElementById(fd3).style.display='none';
	}
	if(no==4)
	{
	document.getElementById(fd4).style.display='none';
	}
	
	
}

function firstdatequestion()
{
	document.getElementById('firstdateques').style.display='';
	
}
function datequesans()
{
	document.getElementById('datequesans').style.display='';
	
}

function blockPerson(otheruserid)
{
	var path="controller/postVideos.php?blockyes=yes&otheruserid="+otheruserid;
	var url=path;
	url=url+"&sid="+Math.random()
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	{
		alert ("Browser does not support HTTP Request")
		return
	} 
	xmlHttp.onreadystatechange=onblockPerson
	xmlHttp.open("GET",url,true) 
	xmlHttp.send(null) 
}

function onblockPerson()
{
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"	)
	{
		if(xmlHttp.responseText != '')
		{
			closeBox();
			location.href="index.php?page=9&generalid="+xmlHttp.responseText;
		}
	}
}

function unblockPerson(otheruserid)
{
	var path="controller/postVideos.php?unblockyes=yes&otheruserid="+otheruserid;
	var url=path;
	url=url+"&sid="+Math.random()
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	{
		alert ("Browser does not support HTTP Request")
		return
	} 
	xmlHttp.onreadystatechange=onunblockPerson
	xmlHttp.open("GET",url,true) 
	xmlHttp.send(null) 
}

function onunblockPerson()
{
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"	)
	{
		if(xmlHttp.responseText != '')
		{
			closeBox();
			location.href="index.php?page=9&generalid="+xmlHttp.responseText;
		}
	}
}

function delaccount(d)
{
var rs=confirm("Are U Sure U Want to Delete Your Account?");
if(rs==true)
{
	
	window.location.href='controller/delaccount.php?account_id='+d;
}
else
{
	return false;
}
}

function calc() 
{
first = document.loveform.name1.value.toUpperCase();
firstlength = document.loveform.name1.value.length;
second = document.loveform.name2.value.toUpperCase();
secondlength = document.loveform.name2.value.length;
var LoveCount=0;
for (Count=0; Count < firstlength; Count++) {
letter1=first.substring(Count,Count+1);
if (letter1=='L') LoveCount+=2; 
if (letter1=='O') LoveCount+=2; 
if (letter1=='V') LoveCount+=2; 
if (letter1=='E') LoveCount+=2; 
if (letter1=='Y') LoveCount+=3; 
if (letter1=='O') LoveCount+=1; 
if (letter1=='U') LoveCount+=3;
}

for (Count=0; Count < secondlength; Count++) {
letter2=second.substring(Count,Count+1);
if (letter2=='L') LoveCount+=2;
if (letter2=='O') LoveCount+=2; 
if (letter2=='V') LoveCount+=2; 
if (letter2=='E') LoveCount+=2;
if (letter2=='Y') LoveCount+=3;
if (letter2=='O') LoveCount+=1;
if (letter2=='U') LoveCount+=3; 
}

amount=0;
if (LoveCount> 0) amount=  5-((firstlength+secondlength)/2)
if (LoveCount> 2) amount= 10-((firstlength+secondlength)/2)
if (LoveCount> 4) amount= 20-((firstlength+secondlength)/2)
if (LoveCount> 6) amount= 30-((firstlength+secondlength)/2)
if (LoveCount> 8) amount= 40-((firstlength+secondlength)/2)
if (LoveCount>10) amount= 50-((firstlength+secondlength)/2)
if (LoveCount>12) amount= 60-((firstlength+secondlength)/2)
if (LoveCount>14) amount= 70-((firstlength+secondlength)/2)
if (LoveCount>16) amount= 80-((firstlength+secondlength)/2)
if (LoveCount>18) amount= 90-((firstlength+secondlength)/2)
if (LoveCount>20) amount=100-((firstlength+secondlength)/2)
if (LoveCount>22) amount=110-((firstlength+secondlength)/2)

if (firstlength==0 || secondlength==0) amount= "Err";
if (amount < 0) amount= 0;
if (amount >99) amount=99;

document.loveform.output.value=amount+"%";
}

function changeSexS()
{
	var gender="";
	var sex="sex";
	for(var l=1;l<=2;l++)
	{
		if(document.getElementById(sex+l).checked)
		{
			var g1=sex+l;
			gender=document.getElementById(g1).value;
		}
	}
	
	var url="view/middleImage.php?middleimagedisplay=yes&gender="+gender;
	url=url+"&sid="+Math.random()
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	{
		alert ("Browser does not support HTTP Request")
		return
	} 
	xmlHttp.onreadystatechange=onrandomImageDisplay
	xmlHttp.open("GET",url,true) 
	xmlHttp.send(null) 
}
/*var software_number = 1;
    function addSoftwareInput() 
    {
	  
		var d = document.createElement("div");
        var l = document.createElement("a");
        var software = document.createElement("input");
        software.setAttribute("type", "file");
        software.setAttribute("id", "software"+software_number);
        software.setAttribute("name", "s[]");
        software.setAttribute("size", "50");
        software.setAttribute("maxlength", "74");
        l.setAttribute("href", "javascript:removeSoftwareInput('s["+software_number+"]');");
        d.setAttribute("id", "s["+software_number+"]"); 
        
        var image = document.createTextNode("Delete");
        l.appendChild(image);
        
        
        d.appendChild(software);
        d.appendChild(l);
        
        document.getElementById("moreSoftware").appendChild(d);
        software_number++;
        software.focus();
    }
    
    function removeSoftwareInput(i) 
    {  
	    var elm = document.getElementById(i); 
		document.getElementById("moreSoftware").removeChild(elm); 
    }*/
	function delfriend(typ,usrid,frndid)
	{
		
		if(typ=='sweetlist')
		{
		var statres=window.confirm('Are you sure you want to delete this person?');
		}
		if(typ=='friendlist')
		{
		var statres=window.confirm('Are you sure you want to delete this person?');
		}
		
		if(statres==true)
		{
		
		var path="controller/delfriends.php?friend_id="+frndid+"&userid="+usrid+"&typ="+typ;
	var url=path;
	url=url+"&sid="+Math.random()
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	{
		alert ("Browser does not support HTTP Request")
		return
	} 
	xmlHttp.onreadystatechange=del_friend
	xmlHttp.open("GET",url,true) 
	xmlHttp.send(null) 
		}
		
	}
	function del_friend()
    {
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"	)
	{
	window.location.href='index.php?page=9';	
	}
  }
  function getNames()
{
first = document.loveform.name1.value.toUpperCase();
firstlength = document.loveform.name1.value.length;
second = document.loveform.name2.value.toUpperCase();
secondlength = document.loveform.name2.value.length;

 var path="controller/getFrndnames.php?first="+first+"&second="+second;
	var url=path;
	url=url+"&sid="+Math.random()
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	{
		alert ("Browser does not support HTTP Request")
		return
	} 
	xmlHttp.onreadystatechange=getfrndnames
	xmlHttp.open("GET",url,true) 
	xmlHttp.send(null)
}
function getfrndnames()
    {
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"	)
	{
		if(xmlHttp.responseText=='fail')
		{
			alert("The profile name you entered could not be located");
		}
		else
		{
	 calc();
		}
	}
	
  }
