// JavaScript Document

var jsyahooarray =  new Array("yahoo.com","yahoo.co.in","yahoo.co.uk","rocketmail.com","ymail.com","yahoo.ca","yahoo.com.ar","yahoo.com.au","y7mail.com","yahoo.com.br","yahoo.cl","yahoo.com.co","yahoo.de","yahoo.gr","yahoo.es","yahoo.fr","yahoo.in","yahoo.co.id","yahoo.ie","yahoo.it","yahoo.com.my","yahoo.com.mx","yahoo.co.nz","yahoo.no","yahoo.com.pe","yahoo.com.ph","yahoo.pl","yahoo.com.sg","yahoo.se","yahoo.com.tr","yahoo.com.vn","yahoo.com.tw");

function  checkEnterSearch(e,type){ //e is event object passed from function invocation
	var characterCode ;//literal character code will be stored in this variable
	
	if(e && e.which){ //if which property of event object is supported (NN4)
	e = e;
	characterCode = e.which; //character code is contained in NN4's which property
	}
	else{
	//e = event
	characterCode = e.keyCode; //character code is contained in IE's keyCode property
	}
	
	if(characterCode == 13){ //if generated character code is equal to ascii 13 (if enter key)
		if(type=="1") {
			OnSearchSubmit(1);
		}else if(type=="2") {
			OnSearchSubmit(2);
		}
		
	}
}
function  checkEnterLoginSubmit(e){ //e is event object passed from function invocation
	var characterCode; //literal character code will be stored in this variable
	
	if(e && e.which){ //if which property of event object is supported (NN4)
	e = e;
	characterCode = e.which; //character code is contained in NN4's which property
	}
	else{
	//e = event
	characterCode = e.keyCode; //character code is contained in IE's keyCode property
	}
	
	if(characterCode == 13){ //if generated character code is equal to ascii 13 (if enter key)
			document.frmlogin.submit();
		
	}
}
function  checkEnterSearchMemberCMS(e){ //e is event object passed from function invocation
	var characterCode; //literal character code will be stored in this variable
	
	if(e && e.which){ //if which property of event object is supported (NN4)
	e = e;
	characterCode = e.which; //character code is contained in NN4's which property
	}
	else{
	//e = event
	characterCode = e.keyCode; //character code is contained in IE's keyCode property
	}
	
	if(characterCode == 13){ //if generated character code is equal to ascii 13 (if enter key)
			cmsSearchFormSubmit();
			return false;
		
	}
	return false;
}
function  checkEnterAddNetworks(e){ //e is event object passed from function invocation
	var characterCode; //literal character code will be stored in this variable
	
	if(e && e.which){ //if which property of event object is supported (NN4)
	e = e;
	characterCode = e.which; //character code is contained in NN4's which property
	}
	else{
	//e = event
	characterCode = e.keyCode; //character code is contained in IE's keyCode property
	}
	
	if(characterCode == 13){ //if generated character code is equal to ascii 13 (if enter key)
			onNetworkValidate();
			return false;
		
	}
	//return false;
}

function  checkEnterReturnFalse(e){ //e is event object passed from function invocation
	var characterCode; //literal character code will be stored in this variable
	
	if(e && e.which){ //if which property of event object is supported (NN4)
	e = e;
	characterCode = e.which; //character code is contained in NN4's which property
	}
	else{
	//e = event
	characterCode = e.keyCode; //character code is contained in IE's keyCode property
	}
	
	if(characterCode == 13){ //if generated character code is equal to ascii 13 (if enter key)
		return false;		
	}
	//return false;
}


/**
* Function Used to checking the Popup Blocker
* param popid
* return necessary validation message
*/
function popupBlockAlert(popid)
{
	if (isPopupBlocker(popid)) {
		alert("You have a popup blocker activated.");
	} else {
		//alert("Popup blocker NOT detected.");
	}
}
/**
* Function Used to checking the Popup Blocker
* param objwin
* return status
*/
function isPopupBlocker(objwin) 
{
	oWin = objwin;
	//alert("objwin:"+objwin);
	if (oWin==null || typeof(oWin)=="undefined") {
		return true;
	}else {
		//oWin.close();
		return false;
	}
}
function close_welcomenote()
{
	document.getElementById('light').style.display='none';
	document.getElementById('fade').style.display='none';
	
}
function validate() 
{
	var form	= document.nonwebmailsignup;
	if(TextValidate(form.EmailID,"email address")== false) { return false;}
	if(EmailValidate(form.EmailID,"email address")== false) { return false;}
	if(SecurityValidate(form.EmailID,"email address")== false) { return false;}
	if(TextValidate(form.Password,"Password")== false) { return false;}
	if(SecurityValidate(form.Password,"Password")== false) { return false;}
	if(TextValidate(form.ConfirmPassword,"Confirm Password")== false) { return false;}
	if(SecurityValidate(form.ConfirmPassword,"Confirm Password")== false) { return false;}
	if(trim(form.Password.value)!=trim(form.ConfirmPassword.value)) { 
		alert("Your Password and Confirm Password does not match");
		form.Password.focus();
		return false;	
	}
	document.nonwebmailsignup.submit();
	return true;

}
function findNewHeight(Height) {
	var browserName = navigator.appName;
	if (browserName=="Microsoft Internet Explorer")	{
		var NewHeight = Height+15;
	} else {
		var NewHeight = Height;	
	}	
	return NewHeight;
}
function findNewWidth(Width) {
	var browserName = navigator.appName;
	if (browserName=="Microsoft Internet Explorer")	{
		var NewWidth = Width+15;
	} else {
		var NewWidth = Width;	
	}	
	return NewWidth;
}


function profilephotopopup(path,x,y) 
{
	var browserName = navigator.appName;
	if (browserName=="Microsoft Internet Explorer")	{
			var x1 = x+17;
			var y1 = y+15;
	} else {
			//var x1 = x;
			var x1 = x+11;
			var y1 = y+16;
	}	
	
	var newHeight = x1 + 10;
	var newWidth = y1 + 63;
	if (browserName=="Microsoft Internet Explorer")	{
		 newHeight = newHeight+37;
		 newWidth =  newWidth+10;
	}
	var win = window.open("popupimage.php?path="+path+"&x="+x1+"&y="+y1,"ProfilePhoto","height="+y1+",width="+x1+",toolbar=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no");	
	if(navigator.userAgent.indexOf('Chrome') == -1) {
		win.moveTo(screen.width/2-newWidth/2, screen.height/2-newHeight/2);
	}
}

function ViewProfileLockerPage() {
	var url = "lockerpage.php";
	if(window.opener && !window.opener.closed) {
		window.opener.parent.location.href = "lockerpage.php";
		if(window.parent) {
			window.parent.close();
		}
	}else if(window.parent) {
		var win = window.open("lockerpage.php","LockerPage","height=1200,width=1400,toolbar=yes,directories=yes,status=yes,menubar=yes,scrollbars=yes,resizable=yes");
		window.parent.close();
	}			
}

function ViewProfileLockerPageYouTube() {
	var url = "../lockerpage.php";
	if(window.opener && !window.opener.closed) {
		window.opener.parent.location.href=url;
		if(window.parent) {
			window.parent.close();
		}
	}else if(window.parent) {
		var win = window.open(url,"LockerPage","height=1200,width=1400,toolbar=yes,directories=yes,status=yes,menubar=yes,scrollbars=yes,resizable=yes");
		window.parent.close();
	}			
}

function RedirectPage(url,is_parent_close,windowname) {	
	url = "lockerpage.php";
	if(windowname=="1") {
		url = "../"+url;	
	}
	if(window.opener && !window.opener.closed) {
		window.opener.parent.location.href = url;
		if(is_parent_close==0 && window.parent) {
			window.parent.close();
		}
	}else if(window.parent) {
		var win = window.open(url,windowname,"height=1200,width=1400,toolbar=yes,directories=yes,status=yes,menubar=yes,scrollbars=yes,resizable=yes");
		if(is_parent_close==0 && window.parent) {
			window.parent.close();	
		}
		
	}			
}


function testcreateMyWindowImport()
{
	var newHeight = 503;
	var newWidth = 490;
	var win = window.open('testcheckWebMailImport.php','testWebMailImport','height='+newHeight+',width='+newWidth+',toolbar=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no');
	if(navigator.userAgent.indexOf('Chrome') == -1) {
		win.moveTo(screen.width/2-newWidth/2, screen.height/2-newHeight/2);
	}
}


function ViewAddressBookPopUpFrom(emailid)
{
	var newHeight = 660;
	var newWidth = 485;
	var win = window.open("addressBook.php?emailid="+emailid+"#"+emailid,"ViewAddressBook","height="+newHeight+",width="+newWidth+",toolbar=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no");	
	if(navigator.userAgent.indexOf('Chrome') == -1) {
		win.moveTo(screen.width/2-newWidth/2, screen.height/2-newHeight/2);
	}
	window.parent.close();
}


function ViewAddressBookPopUpFromYoutube(emailid)
{
	var newHeight = 660;
	var newWidth = 485;
	var win = window.open("../addressBook.php?emailid="+emailid+"#"+emailid,"ViewAddressBook","height="+newHeight+",width="+newWidth+",toolbar=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no");	
	if(navigator.userAgent.indexOf('Chrome') == -1) {
		win.moveTo(screen.width/2-newWidth/2, screen.height/2-newHeight/2);
	}
	window.parent.close();
}

function ViewBookmarkPopUpFromYoutube()
{
	var newHeight = 530;
	var newWidth = 730;
	var win = window.open("../viewBookmarks.php","Bookmarks","height="+newHeight+",width="+newWidth+",toolbar=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no");	
	if(navigator.userAgent.indexOf('Chrome') == -1) {
		win.moveTo(screen.width/2-newWidth/2, screen.height/2-newHeight/2);
	}
	window.parent.close();
}

function OpenPopupWindow(url,windowname,winheight,winwidth,parent) {
	var win = window.open(url,windowname,'height='+winheight+',width='+winwidth+',toolbar=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no');
	if(navigator.userAgent.indexOf('Chrome') == -1) {
		win.moveTo(screen.width/2-winwidth/2, screen.height/2-winheight/2);
	}
	if(parent=='0') {
		window.parent.close(); 	 
	}
}
function ResizePopUpWindow(newHeight,newWidth,windowname) {
	var browserName = navigator.appName;
	
	if(navigator.userAgent.indexOf('Chrome') != -1) {
		newHeight = newHeight+3;
		newWidth =  newWidth+4;
	}else if (browserName=="Microsoft Internet Explorer") {
		newHeight = newHeight+15;	
	}else if (browserName=="Netscape") {
		if(window.statusbar && window.statusbar.visible==true) {	
			newHeight = newHeight+20;	
		}
		if(window.locationbar && window.locationbar.visible==true) {	
			newHeight = newHeight;	
		}else {
			newHeight = newHeight-20;	
		}
	}
	window.resizeTo(newWidth,newHeight);
	if(navigator.userAgent.indexOf('Chrome') == -1) {
		window.moveTo(screen.width/2-newWidth/2, screen.height/2-newHeight/2);
	}
	window.name = windowname;
}
function ResizeOnlyPopUpWindow(newHeight,newWidth) {
	var browserName = navigator.appName;
	if(navigator.userAgent.indexOf('Chrome') != -1) {
		newHeight = newHeight+3;
		newWidth =  newWidth+4;
	}else if (browserName=="Microsoft Internet Explorer") {
		newHeight = newHeight+17;	
	}else if (browserName=="Netscape") {
		if(window.statusbar && window.statusbar.visible==true) {	
			newHeight = newHeight+20;	
		}
		if(window.locationbar && window.locationbar.visible==true) {	
			newHeight = newHeight;	
		}else {
			newHeight = newHeight-20;	
		}
	}
	window.resizeTo(newWidth,newHeight);
	if(navigator.userAgent.indexOf('Chrome') == -1) {
		window.moveTo(screen.width/2-newWidth/2, screen.height/2-newHeight/2);
	}
}


function onSocialOtherNetworkSubmitProfileYoutube(id,formaction,from)
{
	var newHeight = 674;
	var newWidth = 876;
	var win = window.open(formaction+"?formaction=submit&id="+id+"&from="+from,"SocialSites","height="+newHeight+",width="+newWidth+",toolbar=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no");	
	if(navigator.userAgent.indexOf('Chrome') == -1) {
		win.moveTo(screen.width/2-newWidth/2, screen.height/2-newHeight/2);
	}
	window.parent.close();
}
function onSocialOtherNetworkSubmitYoutubePop(id,formaction,from)
{
	var newHeight = 674;
	var newWidth = 876;
	var win = window.open(formaction+"?formaction=submit&id="+id+"&from="+from,"SocialSites","height="+newHeight+",width="+newWidth+",toolbar=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no");	
	if(navigator.userAgent.indexOf('Chrome') == -1) {
		win.moveTo(screen.width/2-newWidth/2, screen.height/2-newHeight/2);
	}
}
function onSocialOtherNetworkSubmitYoutubePopNew(id,formaction,from)
{
	if(document.getElementById("pageload")) {
		var newHeight = 674;
		var newWidth = 876;
		var win = window.open(formaction+"?formaction=submit&id="+id+"&from="+from,"SocialSites","height="+newHeight+",width="+newWidth+",toolbar=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no");	
		if(navigator.userAgent.indexOf('Chrome') == -1) {
			win.moveTo(screen.width/2-newWidth/2, screen.height/2-newHeight/2);
		}
	}
}

function onSocialOtherNetworkSubmit(id,formaction,from)
{
	var newHeight = 501;
	var newWidth = 487;
	var win = window.open(formaction+"?formaction=submit&id="+id+"&from="+from,"SocialSites","height="+newHeight+",width="+newWidth+",toolbar=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no");	
	if(navigator.userAgent.indexOf('Chrome') == -1) {
		win.moveTo(screen.width/2-newWidth/2, screen.height/2-newHeight/2);
	}
	window.parent.close();
	
}
function onSocialOtherNetworkSubmitPop(id,formaction,from)
{
	var newHeight = 501;
	var newWidth = 487;
	var win = window.open(formaction+"?formaction=submit&id="+id+"&from="+from,"SocialSites","height="+newHeight+",width="+newWidth+",toolbar=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no");	
	if(navigator.userAgent.indexOf('Chrome') == -1) {
		win.moveTo(screen.width/2-newWidth/2, screen.height/2-newHeight/2);
	}
}

function onSocialOtherNetworkSubmitPopNew(id,formaction,from,sameuser,parent)
{
	if(document.getElementById("pageload")) {
		if(formaction=="viewDizzlerSites.php") {
			var newWidth = 539;
			var newHeight = (sameuser=="1") ? 471 : 509; 
			var windowname = "Dizzler";
		}else {
			var newWidth = 485;
			var newHeight = (sameuser=="1") ? 514 : 552; 
			var windowname = "SocialSites";
		}
		var win = window.open(formaction+"?formaction=submit&id="+id+"&from="+from,windowname,"height="+newHeight+",width="+newWidth+",toolbar=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no");	
		if(navigator.userAgent.indexOf('Chrome') == -1) {
			win.moveTo(screen.width/2-newWidth/2, screen.height/2-newHeight/2);
		}
		if(parent=="0") {
			window.parent.close();		
		}
	}
}



function onSocialOtherNetworkSubmitYoutube(id,formaction,from)
{
	var newHeight = 681;
	var newWidth = 805;
	var win = window.open(formaction+"?formaction=submit&id="+id+"&from="+from,"SocialSites","height="+newHeight+",width="+newWidth+",toolbar=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no");	
	if(navigator.userAgent.indexOf('Chrome') == -1) {
		win.moveTo(screen.width/2-newWidth/2, screen.height/2-newHeight/2);
	}
	window.parent.close();
	
}
function onSocialOtherNetworkSubmitYoutubeNew(id,formaction,from,parent)
{
	var newHeight = 681;
	var newWidth = 805;
	var win = window.open(formaction+"?formaction=submit&id="+id+"&from="+from,"SocialSites","height="+newHeight+",width="+newWidth+",toolbar=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no");	
	if(navigator.userAgent.indexOf('Chrome') == -1) {
		win.moveTo(screen.width/2-newWidth/2, screen.height/2-newHeight/2);
	}
	if(parent=="0") {
		window.parent.close();		
	}
	
}

function onVideosPopUp(email)
{
	var newHeight = 681;
	var newWidth = 805;
	var win = window.open("youtube/myVideos.php?checkertype=2&emailid="+email,"FriendVideos","height="+newHeight+",width="+newWidth+",toolbar=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no");	
	if(navigator.userAgent.indexOf('Chrome') == -1) {
		win.moveTo(screen.width/2-newWidth/2, screen.height/2-newHeight/2);
	}
	window.parent.close();

}

function OnOpenAddContactPopUp(){
	var newHeight = 650;
	var newWidth = 520;
	var emailid = document.getElementById("mailidencode").value;
	var win = window.open('addContact.php?emailid='+emailid,'AddContact','height='+newHeight+',width='+newWidth+',toolbar=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no');
	if(navigator.userAgent.indexOf('Chrome') == -1) {
		win.moveTo(screen.width/2-newWidth/2, screen.height/2-newHeight/2);
	}
	window.parent.close(); 
}




function onOpenFullPopUp(url) {	
	var win = window.open(url,'SocialNetwork','height=1200,width=1400,toolbar=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes');
	popupBlockAlert(win);
	//win.moveTo(300,300);
}

function onOpenFullPopUpPage(url,windowname) {	
	var win = window.open(url,windowname,'height=1200,width=1400,toolbar=yes,directories=yes,status=yes,menubar=yes,scrollbars=yes,resizable=yes');
	popupBlockAlert(win);
}
function onOpenFullPopUpPageNew(url,windowname) {	
	if(document.getElementById("pageload")) {
		var win = window.open(url,windowname,'height=1200,width=1400,toolbar=yes,directories=yes,status=yes,menubar=yes,scrollbars=yes,resizable=yes');
		popupBlockAlert(win);
	}
}

function onViewScrappopUpLocker()
{
	var newHeight = 595;
	var newWidth = 487;
	var id = document.getElementById("scrap_toid").value;
	var from = document.getElementById("scrap_from").value;
	var win = window.open("viewScrap.php?from="+from+"&id="+id,"ViewScrap","height="+newHeight+",width="+newWidth+",toolbar=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no");	
	if(navigator.userAgent.indexOf('Chrome') == -1) {
		win.moveTo(screen.width/2-newWidth/2, screen.height/2-newHeight/2);
	}
}

function onViewScrappopUp()
{
	var newHeight = 595;
	var newWidth = 487;
	var id = document.getElementById("scrap_toid").value;
	var from = document.getElementById("scrap_from").value;
	var win = window.open("viewScrap.php?from="+from+"&id="+id,"ViewScrap","height="+newHeight+",width="+newWidth+",toolbar=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no");	
	if(navigator.userAgent.indexOf('Chrome') == -1) {
		win.moveTo(screen.width/2-newWidth/2, screen.height/2-newHeight/2);
	}
	window.parent.close();
}
function onViewFriendScrappopUp()
{
	if(document.getElementById("totalmessagespan").innerHTML=="0") {		
		return false;
	}
	if(document.getElementById("UserId").value>0) {
		var newHeight = 595;
		var newWidth = 487;
		var id = document.getElementById("useridencode").value;
		var win = window.open("viewScrap.php?from=address&id="+id,"ViewScrap","height="+newHeight+",width="+newWidth+",toolbar=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no");	
		if(navigator.userAgent.indexOf('Chrome') == -1) {
			win.moveTo(screen.width/2-newWidth/2, screen.height/2-newHeight/2);
		}
		window.parent.close();
	}
	return false;
}

function onPhotoPopUpAddress(from)
{
		if(document.getElementById("mailidencode").value!="") {
			var newHeight = 517;
			var newWidth  = 486;
			var email = document.getElementById("mailidencode").value
			var win = window.open('profilePhotos.php?emailid='+email+'&from='+from,'ProfilePhotos','height='+newHeight+',width='+newWidth+',toolbar=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no');
			if(navigator.userAgent.indexOf('Chrome') == -1) {
				win.moveTo(screen.width/2-newWidth/2, screen.height/2-newHeight/2);
			}
			window.parent.close();
		}else {
			return false;	
		}
		return true;
}

function onVideosPopUpAddress(from)
{
		if(document.getElementById("UserId").value>0) {
			var newHeight = 681;
			var newWidth = 805;
			var email = document.getElementById("mailidencode").value
			var win = window.open("youtube/myVideos.php?checkertype=2&emailid="+email+'&from='+from,"FriendVideos","height="+newHeight+",width="+newWidth+",toolbar=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no");	
			if(navigator.userAgent.indexOf('Chrome') == -1) {
				win.moveTo(screen.width/2-newWidth/2, screen.height/2-newHeight/2);
			}
			window.parent.close();			
		}else {
			return false;	
		}
		return true;
}


function onMusicPopUpAddress(from)
{
		if(document.getElementById("UserId").value>0) {
			var newHeight = 517;
			var newWidth = 560;
			var email = document.getElementById("mailidencode").value;			
			var win = window.open("friendAudio.php?emailid="+email+'&from='+from,"FriendAudio","height="+newHeight+",width="+newWidth+",toolbar=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no");	
			if(navigator.userAgent.indexOf('Chrome') == -1) {
				win.moveTo(screen.width/2-newWidth/2, screen.height/2-newHeight/2);
			}
			window.parent.close();			
		}else {
			return false;	
		}
		return true;
}



function onAddStickyPopupAddress(from)
{
		if(document.getElementById("UserId").value>0) {
			var newHeight = 415;
			var newWidth = 485;
			var StickyTo = document.getElementById("useridencode").value;
			var emailid = document.getElementById("mailidencode").value;
			var win = window.open('addSticky.php?emailid='+emailid+'&from='+from+'&StickyTo='+StickyTo,'AddSticky','height='+newHeight+',width='+newWidth+',toolbar=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no');
			if(navigator.userAgent.indexOf('Chrome') == -1) {
				win.moveTo(screen.width/2-newWidth/2, screen.height/2-newHeight/2);
			}
			window.parent.close();
			
		}else {
			return false;	
		}
		return true;
}





function resetTheme(id)
{
	var form	= document.form1;
	var resetid = id-1;
	form.theme[resetid].checked = true;
	return false;
}

function onEnlargedNextPhoto(photoid)
{
	var form	= document.enlargedphoto;
	form.id.value = photoid;
	ajaxEnlargedNextPhoto(form);
	return false;
}



function onViewFriendSocialSitesPopUp(emailid,socialnetwork)
{
	var form	= document.friendprofile;
	form.EmailID.value = emailid ;
	form.socialnetworktype.value = socialnetwork ;
	form.submit();
	return true;
}

function onViewPicasaSitesSubmit(emailid,socialnetwork,formaction)
{
	var form	= document.friendprofile;
	form.EmailID.value = emailid ;
	form.socialnetworktype.value = socialnetwork ;
	form.action = formaction;
	form.submit();
	return true;
}
function onSocialOtherNetworkSubmitProfile(id,formaction,from)
{
	var form	= document.friendprofile;
	form.id.value = id ;
	form.from.value = from;
	form.action = formaction;	
	form.submit();
	return true;
}

function onSocialOtherNetworkFromCMS(id,formaction,from)
{
	document.getElementById("usernetworkframe").style.display ="";
	var url = formaction+"?formaction=submit&id="+id+"&from="+from;
	var newheight = 100;
	var newwidth  = 100;
	if(formaction=="../youtube/myVideos.php") { 
		newheight = 683;
		newwidth  = 800;
		var browserName = navigator.appName;
		if (browserName=="Microsoft Internet Explorer") {
			newheight = newheight+5; 
			newwidth  = newwidth+5; 
		}
	}else if(formaction=="../viewDizzlerSites.php") {
		newheight = 510;
		newwidth  = 540;
		var browserName = navigator.appName;
		if (browserName=="Microsoft Internet Explorer") {
			newheight = newheight+5; 
			newwidth  = newwidth+5; 
		}
	}else{
		newheight = 556; //556 
		newwidth  = 487; //487 
		var browserName = navigator.appName;
		if (browserName=="Microsoft Internet Explorer") {
			newheight = newheight+3; 
			newwidth  = newwidth+3; 
		}
	}
	document.getElementById("usernetworkframe").height =newheight;
	document.getElementById("usernetworkframe").width =newwidth;
	
	document.getElementById("usernetworkframe").src = url;
}






// function used in networks for user profile
function onViewPicasaSitesSubmitYour(emailid,socialnetwork,formaction)
{
	var form	= document.myprofile;
	form.EmailID.value = emailid ;
	form.socialnetworktype.value = socialnetwork ;
	form.action = formaction;
	form.submit();
	return true;
}


function OnBookmarkOwn(title,url)
{
	//alert(url);
	if (window.sidebar) // firefox
		window.sidebar.addPanel(title, url, "");
	else if(window.opera && window.print){ // opera
		var elem = document.createElement('a');
		elem.setAttribute('href',url);
		elem.setAttribute('title',title);
		elem.setAttribute('rel','sidebar');
		elem.click();
	} 
	else if(document.all) { // ie
		window.external.AddFavorite(url, title);
	}else {
		alert("Please press Ctrl+D to add this page to your bookmarks");
		return false;
	}
}
function onAddNetworkDivEnable() {
document.getElementById("addnetworkdiv").style.display = '';
}
function expandcollapse(id,span,hidden) {
	if(id=="seeallwall") {
		if(document.getElementById("seeallwall1")) {
			if(document.getElementById("seeallwall1").style.display=="none") {
				document.getElementById("seeallwall1").style.display="";
				document.getElementById(hidden).value="1";		
				document.getElementById(span).innerHTML = document.getElementById("display_collapse_text").value;
				
			}else {
				document.getElementById("seeallwall1").style.display="none";
				document.getElementById(hidden).value="0";
				document.getElementById(span).innerHTML = document.getElementById("display_seeall_text").value;
			}
		}
		if(document.getElementById("seeallwall2")) {
			if(document.getElementById("seeallwall2").style.display=="none") {
				document.getElementById("seeallwall2").style.display="";
				document.getElementById(hidden).value="1";		
				document.getElementById(span).innerHTML = document.getElementById("display_collapse_text").value;
				
			}else {
				document.getElementById("seeallwall2").style.display="none";
				document.getElementById(hidden).value="0";
				document.getElementById(span).innerHTML = document.getElementById("display_seeall_text").value;
			}
		}
		
	}else {
		if(document.getElementById(id).style.display=="none") {
			document.getElementById(id).style.display="";
			document.getElementById(hidden).value="1";		
			document.getElementById(span).innerHTML = document.getElementById("display_collapse_text").value;
			
		}else {
			document.getElementById(id).style.display="none";
			document.getElementById(hidden).value="0";
			document.getElementById(span).innerHTML = document.getElementById("display_seeall_text").value;
		}
	}
}
function OnSearchSubmit(type)
{
	
	document.getElementById("loginerrormsg").style.display = "none";
	document.getElementById("searcherrormsg").style.display = "none";
	var form	= document.frmsearch;
	form.searchtype.value = type ;
	if(type=="1") {
		if(trim(document.getElementById("yahooquery").value)=="") { 
			//alert("Please enter a keyword to search");
			document.getElementById("searcherrormsg").style.display = "";
			document.getElementById("searcherrormsg").innerHTML = "Please enter a keyword to search";
			document.getElementById("yahooquery").focus();
			return false;
		}
	if(!SecurityValidate1(document.getElementById("yahooquery").value)) {
			document.getElementById("searcherrormsg").style.display = "";
			document.getElementById("searcherrormsg").innerHTML = "Please enter a valid keyword to search";
			document.getElementById("yahooquery").focus();
			return false;
	}
		
		form.query.value = document.getElementById("yahooquery").value ;
		form.action = "searchResults.php";
	}else {
		if(trim(document.getElementById("qooglequery").value)=="") { 
			//alert("Please enter a keyword to search");
			document.getElementById("searcherrormsg").style.display = "";
			document.getElementById("searcherrormsg").innerHTML = "Please enter a keyword to search";
			document.getElementById("qooglequery").focus();
			return false;
		}
	if(!SecurityValidate1(document.getElementById("qooglequery").value)) {
			document.getElementById("searcherrormsg").style.display = "";
			document.getElementById("searcherrormsg").innerHTML = "Please enter a valid keyword to search";
			document.getElementById("qooglequery").focus();
			return false;
	}
		form.query.value = document.getElementById("qooglequery").value ;	
		form.action = "googleSearchResults.php";
	}	
	form.submit();
	return true;
}

function OnContactUsValidate() {
	var form	= document.form1;
	if(TextValidate(form.FirstName,"First Name")== false) { return false;}
	if(SecurityValidate(form.FirstName,"First Name")== false) { return false;}
	if(TextValidate(form.LastName,"Last Name")== false) { return false;}
	if(SecurityValidate(form.LastName,"Last Name")== false) { return false;}
	if(EmailValidate(form.Email,"Email Address")== false) { return false;}
	if(SecurityValidate(form.Email,"Email Address")== false) { return false;}
	if(TextValidate(form.Subject,"Subject")== false) { return false;}
	if(SecurityValidate(form.Subject,"Subject")== false) { return false;}
	if(TextValidate(form.Phone,"Phone")== false) { return false;}
	if(SecurityValidate(form.Phone,"Phone")== false) { return false;}
	if(TextAreaValidate(form.Message,"Message")== false) { return false;}
	if(SecurityValidate(form.Message,"Message")== false) { return false;}
	if(TextValidate(form.txtsecuritycode,"Access Code")== false) { return false;}
	if(SecurityValidate(form.txtsecuritycode,"Access Code")== false) { return false;}
	form.submit();
	return false;
}
function OnAbuseAlertValidate() {
	var form	= document.form1;
	
	if(trim(document.getElementById("usercheck").value)=="") {
		alert("please choose the correct user to report");
		form.ProfileLink.focus();
		return false;
	}
	if(TextValidate(form.ProfileLink,"Profile Link")== false) { return false;}
	if(SecurityValidate(form.ProfileLink,"Profile Link")== false) { return false;}	
	if(SecurityValidate(form.Name,"Name")== false) { return false;}		
	if(TextAreaValidate(form.Reason,"Brief reason for reporting")== false) { return false;}
	if(SecurityValidate(form.Reason,"reason for reporting")== false) { return false;}
	if(SecurityValidate(form.AdditionalInfo,"Additional Information")== false) { return false;}
	if(TextValidate(form.txtsecuritycode,"Access Code")== false) { return false;}
	if(SecurityValidate(form.txtsecuritycode,"Access Code")== false) { return false;}
	var id = document.getElementById("id").value;
	form.action = "reportAbuse.php?id="+id;
	form.submit();
	return false;
}


function onSendGiftValidate()
{
	var form = document.form1;
	if(OptValidate(form.GiftImageId,"Gift")== false) { return false;}
	if(TextAreaValidate(form.GiftMessage,"message")== false) { return false;}
	if(trim(form.GiftMessage.value)=="write a message") {
		alert("Please enter message");
		form.GiftMessage.focus();
		return false;
	}
	if(SecurityValidate(form.GiftMessage,"message")== false) { return false;}
	form.submit();
	return true;
}
function onCheckGiftOption(row) 
{
	var optionid = "GiftImageId_"+row;
	document.getElementById(optionid).checked = true;
	return false;
}


function onSubmitLogin()
{
	//var form	= document.form1;
	//if(TextValidate(form.email,"email address")== false) { return false;}
	//if(EmailValidate(form.email,"email address")== false) { return false;}
	//if(TextValidate(form.password,"Password")== false) { return false;}
	document.frmlogin.submit();
	return true;
}
function bookmarkSiteValidate(){ 
	var form = document.frm_bookmark;
	if(SelectValidate(form.bookmarkSite,"bookmarking site")== false) { return false;}
	if(TextValidate(form.username,"username")== false) { return false;}
	if(SecurityValidate(form.username,"username")== false) { return false;}
	if(TextValidate(form.password,"password")== false) { return false;}
	if(SecurityValidate(form.password,"password")== false) { return false;}
	document.getElementById("bookmarktype").value = "site";
	document.getElementById("frm_bookmark").submit();
	return true;	
}

 function bookmarkvalidate(){
 	if(TextValidate(document.getElementById("BookmarkName"),"the title")==false){return false;}
	if(SecurityValidate(document.getElementById("BookmarkName"),"title")== false) { return false;}
	if(WebValidate(document.getElementById("BookmarkLink"),"url")==false){return false;}
	if(SecurityValidate(document.getElementById("BookmarkLink"),"url")== false) { return false;}
	if(SecurityValidate(document.getElementById("BookmarkShortDescription"),"notes")== false) { return false;}
	if(SecurityValidate(document.getElementById("TagName"),"category")== false) { return false;}
	if(trim(document.getElementById("BookmarkId").value)=="") {
		document.getElementById("formaction").value = "addnew";
	}else {
		document.getElementById("formaction").value = "edit";
	}
	document.getElementById("frm_editbookmark").action = "editBookmarks.php";
	document.getElementById("frm_editbookmark").submit();
	
 }

function bookmarkFileValidate(){ 
	var form = document.frm_bookmark;
	if(trim(form.bookmarkfile.value)=="") {
		alert("Please select a bookmark file");
		form.bookmarkfile.focus();
		return false;
	}
	if(trim(form.bookmarkfile.value)!="") {
		if (!/(\.(htm|html))$/i.test(form.bookmarkfile.value)){
		alert("Please attach a valid bookmark file");
		form.bookmarkfile.focus();
		return false;
		}
	}
	document.getElementById("bookmarktype").value = "file";
	document.getElementById("frm_bookmark").submit();
	return true;
}

/**
* Name     : addphotoValidate
* Function : Validate the profile image in profile page
* 
**/
function addphotoValidate() 
{
	var form	= document.form1;
	if(document.getElementById("PhotoPath")) {
		 if(trim(form.PhotoPath.value)!=""){
			var filename = form.PhotoPath.value.split(".");
			var len = filename.length-1;
			var file_ext = filename[len];
			file_ext = file_ext.toLowerCase(); 
			if(file_ext!="gif" && file_ext!="jpg"  && file_ext!="jpeg") {
			  //alert("Please select a valid Photo");
			  alert("Please select a valid image of jpg, jpeg or gif formats");
			  form.PhotoPath.focus();
			  return false;
			}  
		}else if(document.getElementById("hidden_PhotoPath").value=="") { 
		  alert("Please select a photo");
		  form.PhotoPath.focus();
		  return false;
		}else {
		  self.close();
		  return false;
		}
	}
	form.submit();
	return true;
}

/**
* Name     : yourProfileValidate
* Function : Validate the form fields in profile page
* 
**/
function yourProfileValidate() 
{
	var form	= document.form1;
	if(TextValidate(form.Firstname,"First Name")== false) { return false;}
	if(SecurityValidate(form.Firstname,"First Name")== false) { return false;}
	if(TextValidate(form.Lastname,"Last Name")== false) { return false;}
	if(SecurityValidate(form.Lastname,"Last Name")== false) { return false;}
	if(OptValidate(form.Gender,"Gender")== false) { return false;}
	if(SelectValidate(form.DOBDAY,"Date of Birth")== false) { return false;}	
	if(SelectValidate(form.DOBMONTH,"Date of Birth")== false) { return false;}	
	if(SelectValidate(form.DOBYEAR,"Date of Birth")== false) { return false;}
	var bdate = form.DOBDAY.value+"-"+form.DOBMONTH.value+"-"+form.DOBYEAR.value;
	if(AgeValidate(bdate,13)== false) { return false;}
	if(TextValidate(form.City,"Hometown / City")== false) { return false;}
	if(SecurityValidate(form.City,"Hometown / City")== false) { return false;}
	if(TextValidate(form.Country,"Country")== false) { return false;}
	if(SecurityValidate(form.Country,"Country")== false) { return false;}
	if(document.getElementById("PrimaryMailID")) {
		if(TextValidate(form.PrimaryMailID,"Email Address")== false) { return false;}
		if(EmailValidate(form.PrimaryMailID,"Email Address")== false) { return false;}	
		if(SecurityValidate(form.PrimaryMailID,"Email Address")== false) { return false;}
	}
	if(document.getElementById("Aboutme")) {		
		if(SecurityValidate(document.getElementById("Aboutme"),"data for about me")== false) { return false;}
	}
	
	
	/*if(SelectValidate(form.RelationshipIn,"Relationship Status")== false) { return false;}
	if(TextValidate(form.ZipCode,"Zip Code")== false) { return false;}
	if(form.SecondaryMailID.value!=""){
		if(EmailValidate(form.SecondaryMailID,"Secondary Mail ID")== false) { return false;}	
	}
	if(NumberValidate(form.ContactNumber,"Contact Number")== false) { return false;}*/
	if(document.getElementById("PhotoPath")) {
		 if(trim(form.PhotoPath.value)!=""){
			var filename = form.PhotoPath.value.split(".");
			var len = filename.length-1;
			var file_ext = filename[len];
			file_ext = file_ext.toLowerCase(); 
			if(file_ext!="gif" && file_ext!="jpg"  && file_ext!="jpeg") {
			  //alert("Please select a valid Photo");
			  alert("Please select a valid image of jpg, jpeg or gif formats");
			  form.PhotoPath.focus();
			  return false;
			}  
		} 				
	}
		
	/*if(TextValidate(form.email,"email address")== false) { return false;}
	if(EmailValidate(form.email,"email address")== false) { return false;}
	if(TextValidate(form.password,"Password")== false) { return false;}
	var post = form.post.value;
	var EmailID = form.email.value;
	var Password = form.password.value;*/
	//form.action="feedback.php";
	//alert(document.nonwebmailsignup);
	//alert("checkWebMailImport.php?email="+EmailID+"&password="+Password+"&from=index&post="+post);
	/*var win = window.open("checkWebMailImport.php?email="+EmailID+"&password="+Password+"&from=index&post="+post,"WebMail","height=300,width=500,toolbar=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes");	
	win.moveTo(80,80);*/
	//document.f1.submit();
	form.submit();
	return true;

}


/**
* Name     : yourProfileValidate
* Function : Validate the form fields in profile page
* 
**/
function yourPageContentValidate() 
{
	var form	= document.form1;
	if(SelectValidate(form.pagetitle,"Page Title")== false) { return false;}
	if(SecurityValidate(form.pagetitle,"Page Title")== false) { return false;}
	alert(form.pagetitle.value);
	form.submit();
	return true;

}

function lockerImageValidate() 
{
	var form	= document.form1;	
	 if(trim(form.user_lockerimage1.value)!=""){
		var filename = form.user_lockerimage1.value.split(".");
		var len = filename.length-1;
		var file_ext = filename[len];
		file_ext = file_ext.toLowerCase(); 
		if(file_ext!="gif" && file_ext!="jpg"  && file_ext!="jpeg") {
		  //alert("Please select a valid Photo");
		  alert("Please select a valid image of jpg, jpeg or gif formats");
		  form.user_lockerimage1.focus();
		  return false;
		}  
	} 
	 if(trim(form.user_lockerimage2.value)!=""){
		var filename = form.user_lockerimage2.value.split(".");
		var len = filename.length-1;
		var file_ext = filename[len]   ;
		file_ext = file_ext.toLowerCase(); 
		if(file_ext!="gif" && file_ext!="jpg"  && file_ext!="jpeg") {
		  //alert("Please select a valid Photo");
		  alert("Please select a valid image of jpg, jpeg or gif formats");
		  form.user_lockerimage2.focus();
		  return false;
		}  
	} 
	 if(trim(form.user_lockerimage3.value)!=""){
		var filename = form.user_lockerimage3.value.split(".");
		var len = filename.length-1;
		var file_ext = filename[len]   ;
		file_ext = file_ext.toLowerCase();
		if(file_ext!="gif" && file_ext!="jpg"  && file_ext!="jpeg") {
		  //alert("Please select a valid Photo");
		  alert("Please select a valid image of jpg, jpeg or gif formats");
		  form.user_lockerimage3.focus();
		  return false;
		}  
	} 
	 if(trim(form.user_lockerimage4.value)!=""){
		var filename = form.user_lockerimage4.value.split(".");
		var len = filename.length-1;
		var file_ext = filename[len]   ;
		file_ext = file_ext.toLowerCase();
		if(file_ext!="gif" && file_ext!="jpg"  && file_ext!="jpeg") {
		  //alert("Please select a valid Photo");
		  alert("Please select a valid image of jpg, jpeg or gif formats");
		  form.user_lockerimage4.focus();
		  return false;
		}  
	} 
	form.submit();
	return true;
}


function yourPictureValidate() 
{
	var form	= document.formPicture;
	//if(TextValidate(form.Firstname,"Firstname")== false) { return false;}
	if(TextValidate(form.PictureName,"Name")== false) { return false;}
	if(SecurityValidate(form.PictureName,"Name")== false) { return false;}
	var filepath = trim(form.PicturePath.value);
	var hiddenpath = trim(form.hidden_PhotoPath.value);
	if(hiddenpath=="" && filepath=="") {
		alert("Please Select  Photo");
		form.PicturePath.focus();
		return false;
	}
	if(filepath!="") {
		if (!/(\.(jpg|jpeg)|JPEG|JPG|GIF|gif)$/i.test(filepath)){
		alert("Please Select Valid Photo");
		form.PicturePath.focus();
		return false;
		}
	}
	form.submit();
	return true;

}

function yourVideoValidate() 
{
	var form	= document.formVideo;
	if(TextValidate(form.VideoName,"Name")== false) { return false;}
	if(SecurityValidate(form.VideoName,"Name")== false) { return false;}
	var filepath = trim(form.VideoPath.value);
	var hiddenpath = trim(form.hidden_VideoPath.value);
	if(hiddenpath=="" && filepath=="") {
		alert("Please Select  Video File");
		form.VideoPath.focus();
		return false;
	}
	if(filepath!="") {
		if (!/(\.(wmv|flv)|mpa|wav)$/i.test(filepath)){
		alert("Please Select Valid Video File");
		form.VideoPath.focus();
		return false;
		}
	}
	form.submit();
	return true;

}
function yourAudioValidate() 
{
	var form	= document.formAudio;
	if(TextValidate(form.AudioName,"Name")== false) { return false;}
	if(SecurityValidate(form.AudioName,"Name")== false) { return false;}
	var filepath = trim(form.AudioPath.value);
	var hiddenpath = trim(form.hidden_AudioPath.value);
	if(hiddenpath=="" && filepath=="") {
		alert("Please Select  Audio File");
		form.AudioPath.focus();
		return false;
	}
	if(filepath!="") {
		if (!/(\.(mp3|mp4)|mpa|wav)$/i.test(filepath)){
		alert("Please Select Valid Audio File");
		form.AudioPath.focus();
		return false;
		}
	}
	form.submit();
	return true;

}


function yourAlbumsValidate() 
{
	var form	= document.formAlbums;
	if(TextValidate(form.AlbumName,"Title")== false) { return false;}
	if(SecurityValidate(form.AlbumName,"Title")== false) { return false;}
	if(TextValidate(form.AlbumDescription,"Description")== false) { return false;}
	if(SecurityValidate(form.AlbumDescription,"Description")== false) { return false;}
	form.submit();
	return true;

}
function audioPlaylistValidate() 
{
	var form	= document.formPlaylist;
	if(TextValidate(form.PlaylistName,"Title")== false) { return false;}
	if(SecurityValidate(form.PlaylistName,"Title")== false) { return false;}
	//if(TextValidate(form.PlaylistDescription,"Description")== false) { return false;}
	form.submit();
	return true;

}
function deleteStickyNew(userid,type,id,i) 
{
	closesticky(i);
	ajax_stickydrawNote(userid,type,id);
}

function addStickyValidate() 
{
	var form	= document.formSticky;
	if(TextValidate(form.StickyTitle,"Title")== false) { return false;}
	if(SecurityValidate(form.StickyTitle,"Title")== false) { return false;}
	if(LengthValidate(form.StickyTitle,20)== false) { return false;}
	if(TextValidate(form.StickyDescription,"Description")== false) { return false;}
	if(SecurityValidate(form.StickyDescription,"Description")== false) { return false;}
	if(LengthValidate(form.StickyDescription,50)== false) { return false;}
	form.submit();
	return true;

}
function addStickyValidateCMS() 
{
	var form	= document.formSticky;
	if(TextValidate(form.StickyTitle,"Title")== false) { return false;}
	if(SecurityValidate(form.StickyTitle,"Title")== false) { return false;}
	if(LengthValidate(form.StickyTitle,20)== false) { return false;}
	if(TextValidate(form.StickyDescription,"Description")== false) { return false;}
	if(SecurityValidate(form.StickyDescription,"Description")== false) { return false;}
	if(LengthValidate(form.StickyDescription,50)== false) { return false;}
	var id = document.getElementById("StickyTo").value;
	form.action = "editProfile.php?id="+id;
	form.submit();
	return true;

}

function onMessageValidate(rowid) 
{
	var form	= document.form1;
	var ScrapMessage = "Message_"+rowid;
	if(trim(document.getElementById(ScrapMessage).value)=="") {
		alert("Please enter Message");
		document.getElementById(ScrapMessage).focus();
		return false;
	}
	if(SecurityValidate(document.getElementById(ScrapMessage),"Message")== false) { return false;}
	document.getElementById("rowid").value = rowid;
	form.submit();
	return true;

}



function onScrapValidate() 
{
	var form	= document.frmscrap;
	if(TextAreaValidate(form.ScrapMessage,"Message")== false) { return false;}
	if(SecurityValidate(form.ScrapMessage,"Message")== false) { return false;}
	var id = document.getElementById("ScrapTo").value;
	form.action = "editProfile.php?id="+id;
	form.submit();
	return true;

}
function onScrapReplyValidate(ival) 
{
	var form	= document.form1;
	form.formaction.value = "reply";
	form.hidden_i.value = ival;
	var ScrapMessage = "ScrapMessage_"+ival;
	if(trim(document.getElementById(ScrapMessage).value)=="") {
		alert("Please enter Message");
		document.getElementById(ScrapMessage).focus();
		return false;
	}
	if(SecurityValidate(document.getElementById(ScrapMessage),"Message")== false) { return false;}
	//if(TextValidate(form.ScrapMessage,"Message")== false) { return false;}
	form.submit();
	return true;

}
function OnClickCancelDiv(id) 
{
	var scrapcount = document.getElementById("scrapcount").value;
	
	
	var replydiv = "replydiv_"+id;
	var replydivimage = "replydivimage_"+id;
	var ScrapMessage = "ScrapMessage_"+id;
	
	document.getElementById(replydiv).style.display="none";	
	document.getElementById(ScrapMessage).value = "";
	document.getElementById(replydivimage).style.display="inline";
	
	return true;
}
function OnClickReplyDiv(id) 
{
	var scrapcount = document.getElementById("scrapcount").value; 	
	for(var j=1;j<=scrapcount;j++) {
		var replydiv = "replydiv_"+j;
		var replydivimage = "replydivimage_"+j;
		var ScrapMessage = "ScrapMessage_"+j;
		var owner = "owner_"+j;
		var msgspan = "msgspan_"+j;
		
		if(document.getElementById(replydiv)) {			
			if(document.getElementById(owner).value=="0") {				
				document.getElementById(replydiv).style.display="none";	
			}
		}
		if(document.getElementById(msgspan)) {			
			if(document.getElementById(owner).value=="0") {	
				document.getElementById(msgspan).innerHTML="";
				document.getElementById(msgspan).style.display="none";	
			}
		}
		if(document.getElementById(ScrapMessage)) {
			document.getElementById(ScrapMessage).value = "";
		}
		if(document.getElementById(replydivimage)) {
			if(document.getElementById(owner).value=="0") {
				document.getElementById(replydivimage).style.display = "inline";
			}
		}	
		
	}
	
	var replydiv = "replydiv_"+id;
	var replydivimage = "replydivimage_"+id;
	var ScrapMessage = "ScrapMessage_"+id;
	
	var msgspan        = "msgspan_"+id;
	document.getElementById(msgspan).innerHTML     = "";;
	document.getElementById(msgspan).style.display = "none";
	
	
	document.getElementById(replydiv).style.display="inline";
	document.getElementById(ScrapMessage).value = "";
	document.getElementById(replydivimage).style.display="none";
	
	return true;
}
function OnHideReplyDiv(id) 
{
	var replydiv = "replydiv_"+id;
	var replydivimage = "replydivimage_"+id;
	var ScrapMessage = "ScrapMessage_"+id;
	if(document.getElementById(replydiv).style.display=="none") {
		document.getElementById(replydiv).style.display="inline";
		document.getElementById(ScrapMessage).value = "";
		document.getElementById(replydivimage).style.display="none";
	}else {
		document.getElementById(replydiv).style.display="none";	
		document.getElementById(ScrapMessage).value = "";
		document.getElementById(replydivimage).style.display="inline";
	}
	return true;
}

function onOpenMessageDiv(rowid) 
{
	
	var rowidcount = document.getElementById("rowidcount").value; 
	for(var j=1;j<=rowidcount;j++) {
		var messagediv = "messgaediv_"+j;
		if(document.getElementById(messagediv)) {
			document.getElementById(messagediv).style.display="none";	
		}
		
	}
	
	var messagediv = "messgaediv_"+rowid;
	var message = "Message_"+rowid;
	document.getElementById(message).value = "";
	if(document.getElementById(messagediv).style.display=="none") {
		document.getElementById(messagediv).style.display="";
	}else {
		//document.getElementById(messagediv).style.display="none";
	}
	document.getElementById(message).focus();
	return false;
}



function onopenbucketvideodiv(id) 
{
	var photobucketvideodiv = "photobucketvideo_"+id;	
	var videocount = document.getElementById("bucketvideocount").value; 
	if(document.getElementById("photobucketvideo_0")) {
		document.getElementById("photobucketvideo_0").style.display="none";	
	}		
	for(var j=1;j<=videocount;j++) {
		var photobucketvideo = "photobucketvideo_"+j;
		var photobucketvideo_temp =  "photobucketvideo_temp_"+j;
		var photobucketvideo_desc = "photobucketvideo_desc_"+j;
		
		if(document.getElementById(photobucketvideo)) {	
			if(j==id) {
				if(document.getElementById(photobucketvideo).style.display!="none") {
					document.getElementById(photobucketvideo).style.display="";
					document.getElementById(photobucketvideo_desc).style.display="";
				}else {
					document.getElementById(photobucketvideo).innerHTML = "";
					document.getElementById(photobucketvideo).innerHTML = document.getElementById(photobucketvideo_temp).innerHTML
					document.getElementById(photobucketvideo).style.display="";	
					document.getElementById(photobucketvideo_desc).style.display="";
				}
				
			}else {
				document.getElementById(photobucketvideo).style.display="none";	
				document.getElementById(photobucketvideo_desc).style.display="none";	
			}				
		}		
	}
	
	return true;
}


function yourMusicValidate() 
{
	var form	= document.formMusic;
	//if(TextValidate(form.Firstname,"Firstname")== false) { return false;}
	form.submit();
	return true;

}
function onchangeNetworks(networkid){
	document.getElementById("networkvalue").value = "User name / Id";
	if(networkid=="1" || networkid=="2" || networkid=="11" || networkid=="9" || networkid=="12" || networkid=="13" || networkid=="14" || networkid=="15") {		
		document.getElementById("networkvaluediv").style.display="none";
		if(document.getElementById("networkvaluedivempty")) {
			document.getElementById("networkvaluedivempty").style.display="inline";	
		}
	}else {		
		document.getElementById("networkvaluediv").style.display="inline";
		if(document.getElementById("networkvaluedivempty")) {
			document.getElementById("networkvaluedivempty").style.display="none";	
		}
	}
	return false;
}

function onNetworkValidate()
{
	var form	= document.form1;
	//var browsercheck = document.getElementById("browsercheck").value;
	if(SelectValidate(form.network,"network")== false) { return false;}
	if(form.network.value=="1") {		
		//if(trim(browsercheck)=="") {
			if(confirm('To add facebook application you need to provide email address and password. Attempt to signup facebook will lose your information and will not add network to your account. Click "OK" to proceed.')) {
				//onOpenFullPopUp('http://www.facebook.com/apps/application.php?id=34076763680#/add.php?api_key=d7c5a780cded15c1a41e425e58bd8a4d');
				onOpenFullPopUp('http://www.facebook.com/login.php?api_key=d7c5a780cded15c1a41e425e58bd8a4d&v=1.0&hide_checkbox=true&skipcookie=true');			
				return false;
			}else {
				return false;	
			}
			//onOpenFullPopUp('http://www.facebook.com/apps/application.php?id=34076763680&ref=nf');
		/*}else {
			alert("The current version of your browser doesnot support session handling properly. Network application may not be added to your account. Please use earlier version to perform this operation");
			return false;
		}*/
		
	}
	if(form.network.value=="2") {		
		return onSocialNetworkBeboAjax();
	}
	if(form.network.value=="11") {		
		return onSocialNetworkMyspaceAjax();
	}
	if(form.network.value=="9") {
		//if(trim(browsercheck)=="") {
			//onOpenFullPopUp('http://www.friendster.com/widget_login.php?api_key=8c34707383e4e0474229396ab21bb350');			
			onOpenFullPopUp('http://www.friendster.com/widget_login.php?api_key=0866aacb45757103d9dd56ea26b1287f');	
			return false;
		/*}else {
			alert("The current version of your browser doesnot support session handling properly. Network application may not be added to your account. Please use earlier version to perform this operation");
			return false;
		}*/
	}
	
	if(form.network.value=="12" || form.network.value=="13" || form.network.value=="14" || form.network.value=="15") {	
			
		
	}else {
	
		if(trim(form.networkvalue.value)=="" || form.networkvalue.value=="User name / Id") {
			//1-Facebook
			if(form.network.value=="1") {
				alert("Please enter your Facebook id");
				form.networkvalue.focus();
				return false;
			}
			//2-Bebo
			if(form.network.value=="2") {
				alert("Please enter your Bebo id");
				form.networkvalue.focus();
				return false;
			}
			//3-Youtube
			if(form.network.value=="3") {
				alert("Please enter your Youtube username");
				form.networkvalue.focus();
				return false;
			}
			//4-Last.fm
			if(form.network.value=="4") {
				alert("Please enter your Last.fm username");
				form.networkvalue.focus();
				return false;
			}
			//5-Hi5
			if(form.network.value=="5") {
				alert("Please enter your Hi5 email id");				
				form.networkvalue.focus();
				return false;
			}
			//6-Picasa
			if(form.network.value=="6") {
				alert("Please enter your Picasa email id");
				form.networkvalue.focus();
				return false;
			}
			//7-Flickr
			if(form.network.value=="7") {
				alert("Please enter your Flickr email id");
				form.networkvalue.focus();
				return false;
			}
			//8-Skype
			if(form.network.value=="8") {
				alert("Please enter your Skype username");
				form.networkvalue.focus();
				return false;
			}	
			//9-Friendster
			if(form.network.value=="9") {
				alert("Please enter your Friendster id");
				form.networkvalue.focus();
				return false;
			}	
			//10-Dizzler
			if(form.network.value=="10") {
				alert("Please paste your Dizzler embed code");
				form.networkvalue.focus();
				return false;
			}	
			//11-Myspace
			if(form.network.value=="11") {
				alert("Please enter your Myspace id");
				form.networkvalue.focus();
				return false;
			}
			//16-Photobucket
			if(form.network.value=="16") {
				alert("Please enter your Photobucket username");
				form.networkvalue.focus();
				return false;
			}	
		}
		
		//networkid validation
		if(trim(form.networkvalue.value)!="") {
			//1-Facebook
			if(form.network.value=="1") {
				if(isNaN(form.networkvalue.value)) {
					alert("Please enter your valid Facebook id");				
					form.networkvalue.focus();
					return false;
				}
			}
			//2-Bebo
			if(form.network.value=="2") {
				if(isNaN(form.networkvalue.value)) {
					alert("Please enter your valid Bebo id");				
					form.networkvalue.focus();
					return false;
				}
			}
			
			//3-youtube
			if(form.network.value=="3") {
				var filter  = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
				if (!isCharsInBag(trim(form.networkvalue.value), filter)){
					alert("Please enter your valid Youtube username");				
					form.networkvalue.focus();
					return false;
				}
			}
			
			//3-Last.fm
			if(form.network.value=="4") {
				var filter  = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
				if (!isCharsInBag(trim(form.networkvalue.value), filter)){
					alert("Please enter your valid Last.fm username");				
					form.networkvalue.focus();
					return false;
				}
			}
			
			
			//5-Hi5
			if(form.network.value=="5") {
				if(EmailValidate(form.networkvalue,"Hi5 email id")== false) { return false;}
			}
			//6-Picasa
			if(form.network.value=="6") {
				if(EmailValidate(form.networkvalue,"Picasa mail id")== false) { return false;}
				var mailid = trim(form.networkvalue.value);
				var mailidarray = mailid.split("@");
				var maildomain = mailidarray[1].toLowerCase();
				if(maildomain!="gmail.com" && maildomain!="googlegmail.com") {
					alert("Please enter your valid Picasa email id");				
					form.networkvalue.focus();
					return false;			
				}
		   }
			//7-Flickr
			if(form.network.value=="7") {
				if(EmailValidate(form.networkvalue,"Flickr email id")== false) { return false;}
				var mailid = trim(form.networkvalue.value);
				var mailidarray = mailid.split("@");
				var maildomain = trim(mailidarray[1]);
				maildomain = mailidarray[1].toLowerCase();					
				var flickflag = "";
				var jsyahooarraylen = jsyahooarray.length;
				for(var k=0;k<jsyahooarraylen;k++) {
					if(jsyahooarray[k]==trim(maildomain)) {
						flickflag = "1";	
						break;
					}
				}				
				//if(maildomain!="yahoo.com" && maildomain!="yahoo.co.in" && maildomain!="yahoo.co.uk") {
				if(flickflag=="") {	
					alert("Please enter your valid Flickr email id");				
					form.networkvalue.focus();
					return false;			
				}
			
			}
			//9-Friendster
			if(form.network.value=="9") {
				if(isNaN(form.networkvalue.value)) {
					alert("Please enter your valid Friendster ID Number");				
					form.networkvalue.focus();
					return false;
				}
			}
			//10-Dizzler
			if(form.network.value=="10") {
				var embedarray =  form.networkvalue.value.split("embed");
				var check1 = embedarray.length-1;
				if(embedarray.length<=2 || trim(embedarray[0])!="<" || trim(embedarray[check1])!=">") {
					alert("Please paste your valid Dizzler embed code");				
					form.networkvalue.focus();
					return false;
				}
			}
			//11-Myspace
			if(form.network.value=="11") {
				if(isNaN(form.networkvalue.value)) {
					alert("Please enter your valid Myspace id");				
					form.networkvalue.focus();
					return false;
				}
			}
			//16-Photobucket
			if(form.network.value=="16") {
				var filter  = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";
				if (!isCharsInBag(trim(form.networkvalue.value), filter)){
					alert("Please enter your valid Photobucket username");				
					form.networkvalue.focus();
					return false;
				}
			}
			if(SecurityValidate(form.network,"User name / Id")== false) { return false;}
			
		}
	}
	
	//form.action = "viewYourProfile.php";
	form.actiontype.value ="network";
	form.submit();
	return true;
}

function isCharsInBag (s, bag){  
var i;
// Search through string's characters one by one.
// If character is in bag, append to returnString.

for (i = 0; i < s.length; i++){ 
// Check that current character isn't whitespace.
var c = s.charAt(i);
if (bag.indexOf(c) == -1) return false;
}
return true;
}



function  validateForgotPassword() 
{
	var form	= document.frmforgot;
	if(TextValidate(form.EmailID,"email address")== false) { return false;}
	if(EmailValidate(form.EmailID,"email address")== false) { return false;}
	if(SecurityValidate(form.EmailID,"email address")== false) { return false;}
	form.submit();
	return true;

}
function  validateChangePassword() 
{
	var form	= document.form1;
	if(TextValidate(form.EmailID,"email address")== false) { return false;}
	if(EmailValidate(form.EmailID,"email address")== false) { return false;}
	if(SecurityValidate(form.EmailID,"email address")== false) { return false;}
	if(TextValidate(form.oldpassword,"old password")== false) { return false;}
	if(SecurityValidate(form.oldpassword,"old password")== false) { return false;}
	if(TextValidate(form.newpassword,"new password")== false) { return false;}
	if(SecurityValidate(form.newpassword,"new password")== false) { return false;}
	if(TextValidate(form.confirmpassword,"confirm password")== false) { return false;}
	if(SecurityValidate(form.confirmpassword,"confirm password")== false) { return false;}
	if(Comparepassword(form.newpassword,form.confirmpassword)== false) { return false;}
	form.submit();
	return true;

}


function onStikkmmValidate(rowid) 
{
	var form	= document.form1;
	document.getElementById("rowid").value = rowid;
	var StikkmmTo = document.getElementById("StikkmmTo").value
	form.action = "stikkmm.php?StikkmmTo="+StikkmmTo;
	form.submit();
	return true;
}

function onDeleteFromFriend() 
{
	var form	= document.form1;
	var DisplayName = document.getElementById("DisplayName").value
	if(confirm("Are you sure to remove "+DisplayName+"?")) {
		document.getElementById("actiontype").value = "deltefriend";
		var id = document.getElementById("id").value;
		var feed =  document.getElementById("hidd_seeallfeed").value;
		var wall =  document.getElementById("hidd_seeallwall").value;
		var comment =  document.getElementById("hidd_seeallcomment").value;
		var hidd_page =  document.getElementById("hidd_page").value;	
		if(trim(feed) || trim(wall) || trim(comment) || trim(hidd_page)) {
			var sall = "&all="+feed+wall+comment+hidd_page;
		}else {
			var sall = "";	
		}
		form.action = "lockerpage.php?id="+id+sall;
		form.submit();
		return true;
	}
}

function onSendMessageValidate() 
{
	var form	= document.form1;
	if(TextAreaValidate(form.Message,"Message")== false) { return false;}
	if(SecurityValidate(form.Message,"Message")== false) { return false;}
	document.getElementById("actiontype").value = "message";
	var id = document.getElementById("id").value;
	var feed =  document.getElementById("hidd_seeallfeed").value;
	var wall =  document.getElementById("hidd_seeallwall").value;
	var comment =  document.getElementById("hidd_seeallcomment").value;
	var hidd_page =  document.getElementById("hidd_page").value;	
	if(trim(feed) || trim(wall) || trim(comment) || trim(hidd_page)) {
		var sall = "&all="+feed+wall+comment+hidd_page;
	}else {
		var sall = "";	
	}
	form.action = "lockerpage.php?id="+id+sall;
	form.submit();
	return true;
}
function onSendCommentValidate() 
{
	var form	= document.form1;
	if(TextAreaValidate(form.Comment,"Comment")== false) { return false;}
	if(trim(form.Comment.value)=="Paste your widget, graphic, video, picture, or game embed codes here") {
		alert("Paste your widget, graphic, video, picture, or game embed codes");
		form.Comment.focus();
		return false;
	}
	if(SecurityValidate(form.Comment,"Comment")== false) { return false;}
	document.getElementById("actiontype").value = "comment";
	var id = document.getElementById("id").value;
	var feed =  document.getElementById("hidd_seeallfeed").value;
	var wall =  document.getElementById("hidd_seeallwall").value;
	var comment =  document.getElementById("hidd_seeallcomment").value;
	var hidd_page =  document.getElementById("hidd_page").value;	
	if(trim(feed) || trim(wall) || trim(comment) || trim(hidd_page)) {
		var sall = "&all="+feed+wall+comment+hidd_page;
	}else {
		var sall = "";	
	}
	form.action = "lockerpage.php?id="+id+sall;
	form.submit();
	return true;
}

function onLockerWallWidgetValidate() 
{
	var form	= document.form1;
	//if(TextAreaValidate(form.Widget,"Widget")== false) { return false;}
	if(trim(form.Widget.value)=="" || trim(form.Widget.value)=="Paste your widget, graphic, video, picture, or game embed codes here") {
		alert("Paste your widget, graphic, video, picture, or game embed codes");
		form.Widget.focus();
		return false;
	}
	if(SecurityValidate(form.Widget,"code for widget, graphic, video, picture, or game embed codes")== false) { return false;}	
	document.getElementById("actiontype").value = "widget";
	var id = document.getElementById("id").value;
	var feed =  document.getElementById("hidd_seeallfeed").value;
	var wall =  document.getElementById("hidd_seeallwall").value;
	var comment =  document.getElementById("hidd_seeallcomment").value;
	var hidd_page =  document.getElementById("hidd_page").value;	
	if(trim(feed) || trim(wall) || trim(comment) || trim(hidd_page)) {
		var sall = "&all="+feed+wall+comment+hidd_page;
	}else {
		var sall = "";	
	}
	form.action = "lockerpage.php?id="+id+sall;
	form.submit();
	return true;
}

function webmailValidate() 
{
	var form	= document.f2;
	if(TextValidate(form.email,"email address")== false) { return false;}
	if(EmailValidate(form.email,"email address")== false) { return false;}
	if(SecurityValidate(form.email,"email address")== false) { return false;}
	if(TextValidate(form.password,"Password")== false) { return false;}
	if(SecurityValidate(form.password,"Password")== false) { return false;}
	document.f2.submit();
	return true;

}

/**
* Functin : Used to validate invite form
*
*/
function invitevalidate() 
{
	var form	= document.invite;
	var InviteFrom = trim(form.InviteFrom.value);
	if(TextValidate(form.InviteTo,"email address")== false) { return false;}
	if(SecurityValidate(form.InviteTo,"email address")== false) { return false;}
	var flag="0";
	if(form.InviteTo.value!="") {
		var mailids = trim(form.InviteTo.value).split(",");
		for(var i=0;i<mailids.length;i++) {	
			var emailid = trim(mailids[i]);
			if(trim(emailid)!="") {
				if(EmailValidateCSV(emailid)) {	
					flag="1";
				}else {
					alert(emailid+" is not a valid email address");
					form.InviteTo.focus();
					return false;
					break;
				}
			}			
			if(InviteFrom==emailid) {
				alert("You wont invite yourself");
				form.InviteTo.focus();
				return false;
				break;
			}
		}
	}
	if(flag=="0") {
		alert("Please enter the valid email address");
		form.InviteTo.focus();
		return false;
	}
	
	if(TextAreaValidate(form.InviteMessage,"invitation message")== false) { return false;}
	if(SecurityValidate(form.InviteMessage,"invitation message")== false) { return false;}
	//if(EmailValidate(form.InviteTo,"email address")== false) { return false;}
	document.invite.submit();
	return true;

}


/**
* Functin : Used to validate invite form
*
*/
function inviteopenvalidate() 
{
	document.getElementById("logininviteerrormsg").style.display = "none";
	var form	= document.inviteopen;
	if(trim(form.Name.value)=="") {
		document.getElementById("invitefrienderrormsg").style.display = "";
		//document.getElementById("invitefrienderrormsg").innerHTML = "<P>Please enter Your name</p>";
		document.getElementById("invitefrienderrormsg").innerHTML = "Please enter Your name";
		form.Name.focus();
		return false;
	}
	if(!SecurityValidate1(form.Name.value)) {
		document.getElementById("invitefrienderrormsg").style.display = "";
		document.getElementById("invitefrienderrormsg").innerHTML = "<P>Please enter valid name</p>";
		form.Name.focus();
		return false;
	}
	
	if(trim(form.InviteFrom.value)=="") {
		document.getElementById("invitefrienderrormsg").style.display = "";
		document.getElementById("invitefrienderrormsg").innerHTML = "Please enter Your email address";
		form.InviteFrom.focus();
		return false;
	}
	
	
	if(EmailValidateCSV(trim(form.InviteFrom.value))) {				
	}else {
		document.getElementById("invitefrienderrormsg").style.display = "";
		document.getElementById("invitefrienderrormsg").innerHTML = "Please enter valid email address";
		form.InviteFrom.focus();
		return false;
	}
	
	if(!SecurityValidate1(form.InviteFrom.value)) {
		document.getElementById("invitefrienderrormsg").style.display = "";
		document.getElementById("invitefrienderrormsg").innerHTML = "<P>Please enter valid email address</p>";
		form.InviteFrom.focus();
		return false;
	}
	
	if(trim(form.InviteTo.value)=="") {
		document.getElementById("invitefrienderrormsg").style.display = "";
		document.getElementById("invitefrienderrormsg").innerHTML = "Please enter the email address";
		form.InviteTo.focus();
		return false;
	}
	if(!SecurityValidate1(form.InviteTo.value)) {
		document.getElementById("invitefrienderrormsg").style.display = "";
		document.getElementById("invitefrienderrormsg").innerHTML = "<P>Please enter valid email address</p>";
		form.InviteTo.focus();
		return false;
	}
	
	var flag="0";
	var InviteFrom = trim(form.InviteFrom.value);
	if(trim(form.InviteTo.value)!="") {
		var mailids = trim(form.InviteTo.value).split(",");
		for(var i=0;i<mailids.length;i++) {	
			var emailid = trim(mailids[i]);
			if(trim(emailid)!="") {
				if(EmailValidateCSV(emailid)) {
					flag="1";
				}else {
					document.getElementById("invitefrienderrormsg").style.display = "";
					document.getElementById("invitefrienderrormsg").innerHTML = emailid+" is not a valid email address";
					form.InviteTo.focus();
					return false;
					break;
				}
			}
			if(InviteFrom==emailid) {
				document.getElementById("invitefrienderrormsg").style.display = "";
				document.getElementById("invitefrienderrormsg").innerHTML = "You wont invite yourself";
				alert("You wont invite yourself");
				form.InviteTo.focus();
				return false;
				break;
			}
		}
	}
	if(flag=="0") {
		alert("Please enter the valid email address");
		form.InviteTo.focus();
		return false;
	}
	if(TextAreaValidate(form.InviteMessage,"invitation message")== false) { return false;}
	if(SecurityValidate(form.InviteMessage,"invitation message")== false) { return false;}
	//if(EmailValidate(form.InviteTo,"email address")== false) { return false;}
	form.submit();
	return true;

}




function addFriendsCsvValidate() 
{
	var form	= document.addfriendscsv;
	if(trim(form.csvmailids.value)=="" && trim(form.csv_mailidfile.value)=="") {
		alert("Please enter the email address or select the csv file");
		form.csvmailids.focus();
		return false;
	}
	if(form.csvmailids.value!="") {
		if(SecurityValidate(form.csvmailids,"email address")== false) { return false;}
		var mailids = form.csvmailids.value.split(",");
		//var ContactFrom =document.getElementById("ContactFrom").value; 
		//alert(ContactFrom);
		for(var i=0;i<mailids.length;i++) {	
			var emailid = mailids[i];
			if(trim(emailid)!="") {
				if(EmailValidateCSV(trim(emailid))) {				
					/*if(ContactFrom==trim(emailid)) {
						alert("you wont add your email address to your address book");
						form.csvmailids.focus();
						return false;
					}*/
				}else {
					alert(emailid+" is not a valid email address");
					form.csvmailids.focus();
					return false;
					break;
				}
			}
		}
	}
	if(trim(form.csv_mailidfile.value)!="") {
		if (!/(\.(csv|ldif))$/i.test(form.csv_mailidfile.value)){
		alert("Please attach a valid csv file");
		form.csv_mailidfile.focus();
		return false;
		}
	}	
	document.addfriendscsv.submit();
	return true;

}

function addFriendsOnlyCsvValidate() 
{
	var form	= document.f1;
	var ContactFrom =document.getElementById("ContactFrom").value; 
	if(trim(form.csvmailids.value)=="") {
		alert("Please enter the email address");
		form.csvmailids.focus();
		return false;
	}
	if(SecurityValidate(form.csvmailids,"email address")== false) { return false;}
	var flag = "0";
	if(form.csvmailids.value!="") {
		var mailids = form.csvmailids.value.split(",");
		for(var i=0;i<mailids.length;i++) {	
			var emailid = mailids[i];
			if(trim(emailid)!="") {
				if(EmailValidateCSV(emailid)) {	
					flag = "1";
					if(ContactFrom==trim(emailid)) {
						alert("you wont add your email address to your address book");
						form.csvmailids.focus();
						return false;
					}
				}else {
					alert(emailid+" is not a valid email address");
					form.csvmailids.focus();
					return false;
					break;
				}
			}
		}
	}
	if(flag=="0") {
		alert("Please enter the valid email address");
		form.csvmailids.focus();
		return false;
	}
	form.actiontype.value = "onlycsv";
	document.f1.submit();
	return true;

}
function OnClickMemberOption(membervalue) {
	document.getElementById("membercheck").value = membervalue;
	return false;
}

function addFriendsCsvFileValidate() 
{
	var form	= document.f1;
	if(SelectValidate(form.format,"Format")== false) { return false;}
	if(trim(form.file1.value)=="") {
		alert("Please select the csv file");
		form.file1.focus();
		return false;
	}
	if(trim(form.file1.value)!="") {
		if (!/(\.(csv||ldif))$/i.test(form.file1.value)){
		alert("Please attach a valid csv file");
		form.file1.focus();
		return false;
		}
	}
	document.f1.submit();
	return true;

}


// JavaScript Document
function sendinvitation() {
	var mailcount = document.getElementById("mailcount").value;
	mailids = "";
	for(var i=1;i<=mailcount;i++) {
		var chkbox = "chk_mailid_"+i;
		var mailid = "mailid_"+i;
		if(document.getElementById(chkbox)) {
			if(document.getElementById(chkbox).checked==true) {
				if(mailids!="") {
					if(trim(document.getElementById(mailid).value)!="") {
						mailids = mailids + "," + document.getElementById(mailid).value ;
					}
					
				}else {
					if(trim(document.getElementById(mailid).value)!="") {
							mailids = document.getElementById(mailid).value ;
					}
					
				}					
			
			}
		}					
	
	}
//alert(mailids);
document.getElementById("hidd_mailids").value = mailids;
document.frminvitation.submit();
}

// JavaScript Document
function sendinvitation1() {
	var mailcount = document.getElementById("mailcount").value;
	mailids = "";
	for(var i=1;i<=mailcount;i++) {
		var chkbox = "chk_mailid_"+i;		
		if(document.getElementById(chkbox)) {
			if(document.getElementById(chkbox).checked==true) {
				if(mailids!="") {
					if(trim(document.getElementById(chkbox).value)!="") {
						mailids = mailids + "," + document.getElementById(chkbox).value ;
					}
				}else {
					if(trim(document.getElementById(chkbox).value)!="") {
							mailids = document.getElementById(chkbox).value ;
					}
				}					
			
			}
		}					
	
	}
//alert(mailids);
//return false;
document.getElementById("hidd_mailids").value = mailids;

var form = document.form1;
form.action = "inviteFriends.php";
form.submit();

}


function msnCheck(){
	if ( document.grab.provider.value == 'M' ){
		alert("Please note that this option will grab the contacts from your MSN Messenger and hence the following notes shall be pointed out:\n 1- The names that will appear under the 'Name' column are the names of your contacts in the messenger but not the real names of them. \n 2- If you are currently connected to your account using any instant messaging application then please note that you'll be disconnected from your account in order to make the script works properly!");
	}
}

function clearfunc()
{	  
	  var mailcount = document.getElementById("mailcount").value;
	  for(var i=1;i<=mailcount;i++) {
		var chkbox = "chk_mailid_"+i;
		document.getElementById(chkbox).checked=false;
	  }		
  document.getElementById("hidd_mailids").value = "";			
}
		
		
function checkClearSelectAll(chk)
{
	
	 var mailcount = document.getElementById("mailcount").value;	 
	 if(chk.checked==true) {
		  for(var i=1;i<=mailcount;i++) {
			  var chkbox = "chk_mailid_"+i;
			  document.getElementById(chkbox).checked=true;	
		   }
	  }else {
		  for(var i=1;i<=mailcount;i++) {
			  var chkbox = "chk_mailid_"+i;
			  document.getElementById(chkbox).checked=false;	
		   }
	  }
}
		
function checkFuncAll()
{	  
 var mailcount = document.getElementById("mailcount").value;
  for(var i=1;i<=mailcount;i++) {
	var chkbox = "chk_mailid_"+i;
	document.getElementById(chkbox).checked=true;
  }
}


/**
* Function : hp
* Process  : Used to Set Default Home page.
* Parameter: Form value(this)
*/

function hp(this_obj)
{	
	var agt=navigator.userAgent.toLowerCase();
	if ((agt.indexOf('msie') != -1) && (agt.indexOf('opera') == -1)){			
		this_obj.style.behavior='url(#default#homepage)';
		//this_obj.setHomePage('http://sify.com/');
		var pageurl = document.getElementById("hidden_pageurl").value;
		this_obj.setHomePage(pageurl);
		
	}else if (agt.indexOf('mozilla')!=-1){
		
	}	
}

function onAcceptFriendReq(rowid)
{
		document.getElementById("rowid").value = rowid;
		document.getElementById("actiontype").value = "accept";
		document.form1.submit();
}

function onRejectFriendReq(rowid)
{
	if(confirm("Are you sure you want to reject?")) {
		document.getElementById("rowid").value = rowid;		
		document.getElementById("actiontype").value = "reject";
		document.form1.submit();
 	}  
}

function onDeleteProfileView(rowid)
{
	if(confirm("Are you sure you want to delete?")) {
		var idvar = "ViewId_"+rowid;
		document.getElementById("delid").value = document.getElementById(idvar).value;
		document.form1.submit();
 	}  
}

function onReportAbuse()
{
		document.getElementById("actiontype").value = "abuse";
		var id = document.getElementById("id").value;
		var feed =  document.getElementById("hidd_seeallfeed").value;
		var wall =  document.getElementById("hidd_seeallwall").value;
		var comment =  document.getElementById("hidd_seeallcomment").value;
		var hidd_page =  document.getElementById("hidd_page").value;	
		if(trim(feed) || trim(wall) || trim(comment) || trim(hidd_page)) {
			var sall = "&all="+feed+wall+comment+hidd_page;
		}else {
			var sall = "";	
		}
		document.form1.action = "lockerpage.php?id="+id+sall;
		document.form1.submit();
}
function onDeleteComment(delid)
{
	if(confirm("Are you sure you want to delete the comment?")) {
		document.getElementById("deltype").value = "comment";
		document.getElementById("delid").value = delid;
		var id = document.getElementById("id").value;
		var feed =  document.getElementById("hidd_seeallfeed").value;
		var wall =  document.getElementById("hidd_seeallwall").value;
		var comment =  document.getElementById("hidd_seeallcomment").value;
		var hidd_page =  document.getElementById("hidd_page").value;	
		if(trim(feed) || trim(wall) || trim(comment) || trim(hidd_page)) {
			var sall = "&all="+feed+wall+comment+hidd_page;
		}else {
			var sall = "";	
		}
		document.form1.action = "lockerpage.php?id="+id+sall;
		document.form1.submit();
	}
}
function onDeleteGift(delid)
{
	if(confirm("Are you sure you want to delete the gift?")) {
		document.getElementById("deltype").value = "gift";
		document.getElementById("delid").value = delid;
		var id = document.getElementById("id").value;
		var feed =  document.getElementById("hidd_seeallfeed").value;
		var wall =  document.getElementById("hidd_seeallwall").value;
		var comment =  document.getElementById("hidd_seeallcomment").value;
		var hidd_page =  document.getElementById("hidd_page").value;	
		if(trim(feed) || trim(wall) || trim(comment) || trim(hidd_page)) {
			var sall = "&all="+feed+wall+comment+hidd_page;
		}else {
			var sall = "";	
		}
		document.form1.action = "lockerpage.php?id="+id+sall;
		document.form1.submit();
	}
}
function onDeleteWidget(delid)
{
	if(confirm("Are you sure you want to delete the widget?")) {
		document.getElementById("deltype").value = "widget";
		document.getElementById("delid").value = delid;
		var id = document.getElementById("id").value;
		var feed =  document.getElementById("hidd_seeallfeed").value;
		var wall =  document.getElementById("hidd_seeallwall").value;
		var comment =  document.getElementById("hidd_seeallcomment").value;
		var hidd_page =  document.getElementById("hidd_page").value;	
		if(trim(feed) || trim(wall) || trim(comment) || trim(hidd_page)) {
			var sall = "&all="+feed+wall+comment+hidd_page;
		}else {
			var sall = "";	
		}
		document.form1.action = "lockerpage.php?id="+id+sall;
		document.form1.submit();
	}
}

function onDeleteGiftList(delid)
{
	if(confirm("Are you sure you want to delete the gift?")) {
		document.getElementById("delid").value = delid;
		document.form1.submit();
	}
}




function OnDeleteImage(id)
{
	if(confirm("Are you sure you want to delete the Image?")) {
		document.form1.action="viewAllPhotos.php?delid="+id;
		document.form1.submit();
 	}  
}
function OnDeleteVideo(id)
{
	if(confirm("Are you sure you want to delete the Video?")) {
	    document.form1.action="videos.php?delid="+id;
		document.form1.submit();
 	}  
}
function OnDeleteAudio(id)
{
	if(confirm("Are you sure you want to delete the Music?")) {
	    document.form1.action="audio.php?delid="+id;
		document.form1.submit();
 	}  
}
function OnDeleteAudioPlaylist(id)
{
	if(confirm("Are you sure you want to delete the Playlist?")) {
	    document.form1.action="viewAudioPlaylist.php?delid="+id;
		document.form1.submit();
 	}  
}

function OnDeletePhotoAlbums(id)
{
	if(confirm("Are you sure you want to delete the PhotoAlbums?")) {
	    document.form1.action="viewAllAlbums.php?delid="+id;
		document.form1.submit();
 	}  
}

function OnDeleteScrap(id)
{
	if(confirm("Are you sure you want to delete the Scrap?")) {
		document.form1.formaction.value = "delete";
	    document.form1.action="viewScrap.php?delid="+id;
		document.form1.submit();
 	}  
}
function OnDeleteScrapCMS(id)
{
	if(confirm("Are you sure you want to delete the Scrap?")) {
		document.form1.delid.value = id;
		document.form1.submit();
 	}  
}


function deletelockerimage(id)
{
	if(confirm("Are you sure you want to delete the Photo?")) {
		 document.form1.rowid.value=id;
	    document.form1.actiontype.value="delete";
		document.form1.submit();
 	}  
}

function deleteprofilephoto()
{
	if(confirm("Are you sure you want to delete the Photo?\nBy clicking OK system will permanently delete the photo. Click Cancel to retrieve action")) {
	    document.form1.editprofile1.value="delete";
		document.form1.submit();
 	}  
}


function ClearField(cntrl, cntrltext)
{
	if(trim(document.getElementById(cntrl).value)==trim(cntrltext)){
		document.getElementById(cntrl).value = "";
		return false;
	}
	if(trim(document.getElementById(cntrl).value)==""){
		document.getElementById(cntrl).value = cntrltext;
		return false;
	}
	return true;
	
}
function ClearFieldClick(cntrl, cntrltext)
{
	if(trim(document.getElementById(cntrl).value)==trim(cntrltext)){
		document.getElementById(cntrl).value = "";
		return false;
	}
	if(trim(document.getElementById(cntrl).value)==""){
		//document.getElementById(cntrl).value = cntrltext;
		return false;
	}
	return true;
	
}

function ClearField1(cntrl)
{
	var cntrltext = "First click on your friend's name, and then use this box, or click on the stickies above, to send them a private message, or paste a sticky in their locker.";
	if(trim(document.getElementById(cntrl).value)==trim(cntrltext)){
		document.getElementById(cntrl).value = "";
		return false;
	}
	if(trim(document.getElementById(cntrl).value)==""){
		document.getElementById(cntrl).value = cntrltext;
		return false;
	}
	return true;
	
}
function ClearField1Click(cntrl)
{
	var cntrltext = "First click on your friend's name, and then use this box, or click on the stickies above, to send them a private message, or paste a sticky in their locker.";
	if(trim(document.getElementById(cntrl).value)==trim(cntrltext)){
		document.getElementById(cntrl).value = "";
		return false;
	}
	if(trim(document.getElementById(cntrl).value)==""){
		//document.getElementById(cntrl).value = cntrltext;
		return false;
	}
	return true;
	
}


function ClearFieldPass(cntrl, cntrltext)
{
	var browserName = navigator.appName;
	if(trim(document.getElementById(cntrl).value)==trim(cntrltext) ){
		document.getElementById(cntrl).value = "";
		if (browserName!="Microsoft Internet Explorer") {
			document.getElementById(cntrl).type = "password";	
		}
		return false;
	}else {
		if (browserName!="Microsoft Internet Explorer") {
			document.getElementById(cntrl).type = "text";	
		}
	}
	if(trim(document.getElementById(cntrl).value)==""){		
		document.getElementById(cntrl).value = cntrltext;
		if (browserName!="Microsoft Internet Explorer") {
			document.getElementById(cntrl).type = "text";
		}
		return false;
	}else {
		if (browserName!="Microsoft Internet Explorer") {
			document.getElementById(cntrl).type = "password";
		}
	}
	return true;
	
}

function ClearFieldPassNew(){
	 if(document.getElementById("Password").value == ""){
		document.getElementById('type1').style.display="";		
		document.getElementById('type2').style.display="none";		
		return false;
	}
}

function changetype(e){	
    if(document.getElementById("Password").value == ""){
		document.getElementById('type1').style.display = "";		
		document.getElementById('type2').style.display = "none";		
		return false;
	}
	
 }
 function cleartext(cntrl, defvalue){
	var cntrlvalue = document.getElementById(cntrl).value;	
	//if(document.getElementById(cntrl).value == cntrlvalue && document.getElementById(cntrl).value!=""){
	if(document.getElementById(cntrl).value == defvalue){
	  document.getElementById(cntrl).value = "";
	  return false;
	}else if(document.getElementById(cntrl).value ==""){
		  document.getElementById(cntrl).value = defvalue;
		  return false;
	}
 }


function ClearFieldPassOld(cntrl, cntrltext)
{
	if(trim(document.getElementById(cntrl).value)==trim(cntrltext)){
		document.getElementById(cntrl).value = "";
		document.getElementById(cntrl).type = "password";
		return false;
	}else {
		document.getElementById(cntrl).type = "text";			
	}
	if(trim(document.getElementById(cntrl).value)==""){
		document.getElementById(cntrl).value = cntrltext;
		document.getElementById(cntrl).type = "text";
		return false;
	}else {
		document.getElementById(cntrl).type = "password";	
	}
	
	return true;
	
}

function changePassnew() {		
		if(document.getElementById("Password").value=="") {			
			document.getElementById("type1").style.dispaly="";
			document.getElementById("type2").style.dispaly="none";	
			document.getElementById("Password").value = "password";
		}
		
}

function closeFriendReqPop() {	
	document.getElementById("light").style.display = "none";
	document.getElementById("fade").style.display = "none";
}

function ChangePass() {
		document.getElementById("type1").style.dispaly="none";
		document.getElementById("type2").style.dispaly="";	
		document.getElementById("Password").focus();
}

function ClearFieldkey(cntrl)
{
		alert("before keypress:"+document.getElementById(cntrl).type);
	document.getElementById(cntrl).type = "password";
	alert("after keypress:"+document.getElementById(cntrl).type);
}

function ClearFieldFocus(cntrl)
{
	
	document.getElementById(cntrl).type = "text";
	alert(document.getElementById(cntrl).type);
}


function AssignNetworkDeleteId(id,networkname) {
	document.getElementById("networkdeleteid").value = id;
	document.getElementById("networkname").value = networkname;
	
}


function closeMenu(){
	document.getElementById("menu").style.visibility = '';
}

<!-- controlpanel -->
function validateadminlogin() 
{
	var form	= document.form1;
	if(TextValidate(form.txtusername,"user name")== false) { return false;}
	if(SecurityValidate(form.txtusername,"user name")== false) { return false;}
	if(TextValidate(form.txtpassword,"password")== false) { return false;}
	if(SecurityValidate(form.txtpassword,"password")== false) { return false;}
	form.submit();
	return true;

}

function yourAdminValidate() 
{
	var form	= document.form1;
	if(TextValidate(form.Admin_Username,"User Name")== false) { return false;}
	if(SecurityValidate(form.Admin_Username,"User Name")== false) { return false;}
	if(TextValidate(form.Admin_Password,"Password")== false) { return false;}
	if(SecurityValidate(form.Admin_Password,"Password")== false) { return false;}
	if(TextValidate(form.DisplayName,"Name")== false) { return false;}
	if(SecurityValidate(form.DisplayName,"Name")== false) { return false;}
	if(TextValidate(form.EmailId,"Email Address")== false) { return false;}
	if(EmailValidate(form.EmailId,"Email Address")== false) { return false;}	
	if(SecurityValidate(form.EmailId,"Email Address")== false) { return false;}
	if(SecurityValidate(form.PhoneNo,"Phone Number")== false) { return false;}
	 if(trim(form.PhotoPath.value)!=""){
		var filename = form.PhotoPath.value.split(".");
		var len = filename.length-1;
		var file_ext = filename[len];
		file_ext = file_ext.toLowerCase(); 
		if(file_ext!="gif" && file_ext!="jpg"  && file_ext!="jpeg") {
		  //alert("Please select a valid Photo");
		  alert("Please select a valid image of jpg, jpeg or gif formats");
		  form.PhotoPath.focus();
		  return false;
		}  
	} 	
		
	form.submit();
	return true;

}


/**
* Name     : cmsMemberValidate
* Function : Validate the form fields for new user
* 
**/
function cmsMemberValidate() 
{
	var form	= document.form1;	
	if(TextValidate(form.user_email_id,"Email Address")== false) { return false;}
	if(EmailValidate(form.user_email_id,"Email Address")== false) { return false;}	
	if(SecurityValidate(form.user_email_id,"Email Address")== false) { return false;}
	if(TextValidate(form.user_password,"Password")== false) { return false;}
	if(SecurityValidate(form.user_password,"Password")== false) { return false;}
	if(TextValidate(form.Firstname,"First Name")== false) { return false;}
	if(SecurityValidate(form.Firstname,"First Name")== false) { return false;}
	if(TextValidate(form.Lastname,"Last Name")== false) { return false;}
	if(SecurityValidate(form.Lastname,"Last Name")== false) { return false;}
	//form.action = "editProfile.php?id="+id;
	
	if(OptValidate(form.Gender,"Gender")== false) { return false;}
	//if((trim(form.DOBDAY.value)!="0" && trim(form.DOBDAY.value)!="") || (trim(form.DOBMONTH.value)!="0"  && trim(form.DOBMONTH.value)!="") || (trim(form.DOBYEAR.value)!="0"  && trim(form.DOBYEAR.value)!="")) {
		if(SelectValidate(form.DOBDAY,"Date of Birth")== false) { return false;}	
		if(SelectValidate(form.DOBMONTH,"Date of Birth")== false) { return false;}			
		if(SelectValidate(form.DOBYEAR,"Date of Birth")== false) { return false;}
		var bdate = form.DOBDAY.value+"-"+form.DOBMONTH.value+"-"+form.DOBYEAR.value;
		if(AgeValidate(bdate,13)== false) { return false;}
	//}
	if(TextValidate(form.City,"Hometown / City")== false) { return false;}
	if(SecurityValidate(form.City,"Hometown / City")== false) { return false;}
	if(TextValidate(form.Country,"Country")== false) { return false;}
	if(SecurityValidate(form.Country,"Country")== false) { return false;}
	if(trim(form.PrimaryMailID.value)!=""){
		if(EmailValidate(form.PrimaryMailID,"Email Address")== false) { return false;}	
		if(SecurityValidate(form.PrimaryMailID,"Email Address")== false) { return false;}
	}
	if(document.getElementById("Aboutme")) {		
		if(SecurityValidate(document.getElementById("Aboutme"),"data for about me")== false) { return false;}
	}
	
	 if(trim(form.PhotoPath.value)!=""){
		var filename = form.PhotoPath.value.split(".");
		var len = filename.length-1;
		var file_ext = filename[len];
		file_ext = file_ext.toLowerCase(); 
		if(file_ext!="gif" && file_ext!="jpg"  && file_ext!="jpeg") {
		  //alert("Please select a valid Photo");
		  alert("Please select a valid image of jpg, jpeg or gif formats");
		  form.PhotoPath.focus();
		  return false;
		}  
	} 
	form.submit();
	return true;

}


/**
* Name     : cmsMemberProfileValidate
* Function : Validate the form fields in profile page
* 
**/
function cmsMemberProfileValidate() 
{
	var form	= document.form1;	
	
	if(TextValidate(form.Firstname,"First Name")== false) { return false;}
	if(SecurityValidate(form.Firstname,"First Name")== false) { return false;}
	if(TextValidate(form.Lastname,"Last Name")== false) { return false;}
	if(SecurityValidate(form.Lastname,"Last Name")== false) { return false;}
	if(OptValidate(form.Gender,"Gender")== false) { return false;}
	//if((trim(form.DOBDAY.value)!="0" && trim(form.DOBDAY.value)!="") || (trim(form.DOBMONTH.value)!="0"  && trim(form.DOBMONTH.value)!="") || (trim(form.DOBYEAR.value)!="0"  && trim(form.DOBYEAR.value)!="")) {
	if(SelectValidate(form.DOBDAY,"Date of Birth")== false) { return false;}	
	if(SelectValidate(form.DOBMONTH,"Date of Birth")== false) { return false;}			
	if(SelectValidate(form.DOBYEAR,"Date of Birth")== false) { return false;}
	var bdate = form.DOBDAY.value+"-"+form.DOBMONTH.value+"-"+form.DOBYEAR.value;
	if(AgeValidate(bdate,13)== false) { return false;}
	//}
	if(TextValidate(form.City,"Hometown / City")== false) { return false;}
	if(SecurityValidate(form.City,"Hometown / City")== false) { return false;}
	if(TextValidate(form.Country,"Country")== false) { return false;}
	if(SecurityValidate(form.Country,"Country")== false) { return false;}
	if(trim(form.PrimaryMailID.value)!=""){
		if(EmailValidate(form.PrimaryMailID,"Email Address")== false) { return false;}	
		if(SecurityValidate(form.PrimaryMailID,"Email Address")== false) { return false;}
	}
	if(document.getElementById("Aboutme")) {		
		if(SecurityValidate(document.getElementById("Aboutme"),"data for about me")== false) { return false;}
	}
	 if(trim(form.PhotoPath.value)!=""){
		var filename = form.PhotoPath.value.split(".");
		var len = filename.length-1;
		var file_ext = filename[len];
		file_ext = file_ext.toLowerCase(); 
		if(file_ext!="gif" && file_ext!="jpg"  && file_ext!="jpeg") {
		  //alert("Please select a valid Photo");
		  alert("Please select a valid image of jpg, jpeg or gif formats");
		  form.PhotoPath.focus();
		  return false;
		}  
	} 
	var id = document.getElementById("id").value;
	form.action = "editProfile.php?id="+id;
	form.submit();
	return true;

}

/**
* Name     : cmsMemberLoginInfoValidate
* Function : Validate the form fields in profile page
* 
**/
function cmsMemberLoginInfoValidate() 
{
	var form	= document.form1;	
	if(TextValidate(form.user_email_id,"Email Address")== false) { return false;}
	if(EmailValidate(form.user_email_id,"Email Address")== false) { return false;}
	if(SecurityValidate(form.user_email_id,"Email Address")== false) { return false;}
	if(TextValidate(form.user_password,"Password")== false) { return false;}
	if(SecurityValidate(form.user_password,"Password")== false) { return false;}
	form.editprofile1.value = "savelogin";
	var id = document.getElementById("id").value;
	form.action = "editProfile.php?id="+id;
	form.submit();
	return true;

}
/**
* Name     : cmsBannerValidate
* Function : Validate the form fields in banner page
* 
**/
function cmsBannerValidate() 
{
	var form	= document.form1;	
	if(TextValidate(form.BannerImageDescription,"Description")== false) { return false;}
	if(SecurityValidate(form.BannerImageDescription,"Description")== false) { return false;}
	if(TextValidate(form.BannerImageTitle,"Alt Text")== false) { return false;}
	if(SecurityValidate(form.BannerImageTitle,"Alt Text")== false) { return false;}
	if(trim(form.BannerImageLink.value)!="") {		
		if(WebValidate(form.BannerImageLink,"Link")== false) { return false;}
		if(SecurityValidate(form.BannerImageLink,"Link")== false) { return false;}
	}		
	 if(trim(form.BannerImagePath.value)!=""){
		var filename = form.BannerImagePath.value.split(".");
		var len = filename.length-1;
		var file_ext = filename[len];
		file_ext = file_ext.toLowerCase(); 
		if(file_ext!="gif" && file_ext!="jpg"  && file_ext!="jpeg") {
		  //alert("Please select a valid Image");
		  alert("Please select a valid image of jpg, jpeg or gif formats");
		  form.BannerImagePath.focus();
		  return false;
		}  
	} 	
	var BannerImageId = form.BannerImageId.value;
	form.action = "editBanners.php?code=banners&BannerImageId="+BannerImageId;
	form.submit();
	return true;

}
/**
* Name     : cmsBannerValidate
* Function : Validate the form fields in banner page
* 
**/
function cmsGiftImageValidate() 
{
	var form	= document.form1;	
	if(TextValidate(form.GiftName,"Gift Name")== false) { return false;}	
	if(SecurityValidate(form.GiftName,"Gift Name")== false) { return false;}
	if(SecurityValidate(form.GiftDescription,"Gift Description")== false) { return false;}	
	if(trim(form.GiftImagePath.value)=="" && trim(form.hidd_GiftImagePath.value)==""){
	  alert("Please select Image");
	  form.GiftImagePath.focus();
	  return false;
	}
	 if(trim(form.GiftImagePath.value)!=""){
		var filename = form.GiftImagePath.value.split(".");
		var len = filename.length-1;
		var file_ext = filename[len];
		file_ext = file_ext.toLowerCase(); 
		if(file_ext!="gif" && file_ext!="jpg"  && file_ext!="jpeg") {
		  //alert("Please select a valid Image");
		  alert("Please select a valid image of jpg, jpeg or gif formats");
		  form.GiftImagePath.focus();
		  return false;
		}  
	}
	var GiftImageId = form.GiftImageId.value;
	form.action = "editGiftImages.php?code=gift&GiftImageId="+GiftImageId;
	form.submit();
	return true;

}

function setcmstime(){
		var request;
		if (window.ActiveXObject) {
			request = new ActiveXObject("Microsoft.XMLHTTP");
		}else if (window.XMLHttpRequest) {
			request = new XMLHttpRequest();
		}
		var no = Math.random();		
		var action = "ajaxdatetimeprocess.php?no="+no;
		request.open("GET", action, true);
		request.onreadystatechange = function() {	
			if(request.readyState == 4 && request.status == 200) {
				var answer = request.responseText;
				if(document.getElementById('timecontainer')) {
					document.getElementById('timecontainer').innerHTML = answer;
					
				}
			}
		}
		request.send(null);	
		t=setTimeout('setcmstime()',1000);	
}

function setcmstime_local()
{
	var today=new Date();
	var y=today.getFullYear();
	var m=today.getMonth();
	var dt=today.getDate();
	var d=today.getDay();
	var mins=today.getMinutes();
	var hrs=today.getHours();
	var mins=today.getMinutes();
	mins = checksingledigit(mins);
	dt = checksingledigit(dt);
	m = checksingledigit(m);
	if(hrs > 11) {
		sta="pm"
	}
	else {
		sta="am";
	}
	document.getElementById('datetimediv').innerHTML=dt+"/"+m+"/"+y+" "+hrs+":"+mins+" "+sta;
	t=setTimeout('setcmstime()',500);
}
function checksingledigit(num)
{
	if (num<10)  {
	  num="0" + num;
	 }
    return num;
}
function deleteAdmin() {
	var admincount = document.getElementById("admincount").value;
	var delids = "";
	if(admincount>0) {
		for(var i=1;i<=admincount;i++) {
			var chkid = "chk_id_"+i;			
			if(document.getElementById(chkid).checked==true) {
				if(delids=="") {
					delids = document.getElementById(chkid).value;
				}else {
					delids = delids+","+document.getElementById(chkid).value;
				}
			}
		}
		if(delids!="") {
			if(confirm("Are you sure to delete the selected Admin?")) {
				document.getElementById("delids").value =delids;		
				document.form1.submit();
				return true; 		
			}else {
				return false;
			}
		}else {
			alert("Please select any admin to delete");
			return false;
		}
	}
	return false;
}
function deleteCMSAdmin(id) {
	if(confirm("Are you sure to delete the Admin?")) {
		var reason="";
		reason = prompt("Reason of deletion?","");		
		if(reason!=null) {
			if(trim(reason)!="") {
				if(!SecurityValidate1(reason)) {
					alert("please enter the valid reason to delete the admin");
					return false;
				}
				document.getElementById("delid").value =id;	
				document.getElementById("del_reason").value = reason;
				document.form1.action="manageAdmin.php?code=admin";
				document.form1.submit();
				return true;
			}else {
				alert("please enter the valid reason to delete the admin");
				return false;
			}
		}
	}else {
		return false;
	}

}
function memberSearch(page) {
	if(document.getElementById("page")) {
		document.getElementById("page").value = page;
		document.form1.submit();
	}
}
function cmsSearchFormSubmit() {
	if(document.getElementById("page")) {
		document.getElementById("page").value = 1;
		if(SecurityValidate(document.getElementById("Name"),"Name")== false) { return false;}	
		if(SecurityValidate(document.getElementById("EmailID"),"Email Address")== false) { return false;}
		if(SecurityValidate(document.getElementById("Country"),"Country")== false) { return false;}
		
		document.form1.submit();
	}
}
function deleteMember() {
	var usercount = document.getElementById("usercount").value;
	var delids = "";
	if(usercount>0) {
		for(var i=1;i<=usercount;i++) {
			var chkid = "chk_id_"+i;			
			if(document.getElementById(chkid).checked==true) {
				if(delids=="") {
					delids = document.getElementById(chkid).value;
				}else {
					delids = delids+","+document.getElementById(chkid).value;
				}
			}
		}
		if(delids!="") {
			if(confirm("Are you sure to delete the selected user(s)?")) {
				document.getElementById("delids").value =delids;		
				document.form1.submit();
				return true; 		
			}else {
				return false;
			}
		}else {
			alert("Please select user(s) to delete");
			return false;
		}
	}
	return false;
}
function deletePages() {
	var pagecount = document.getElementById("count").value;
	var delids = "";
	if(pagecount>0) {
		for(var i=1;i<=pagecount;i++) {
			var chkid = "chk_id_"+i;			
			if(document.getElementById(chkid).checked==true) {
				if(delids=="") {
					delids = document.getElementById(chkid).value;
				}else {
					delids = delids+","+document.getElementById(chkid).value;
				}
			}
		}
		if(delids!="") {
			if(confirm("Are you sure to delete the selected page(s)?")) {
				document.getElementById("delids").value =delids;		
				document.form1.submit();
				return true; 		
			}else {
				return false;
			}
		}else {
			alert("Please select page(s) to delete");
			return false;
		}
	}
	return false;
}
function deleteGiftImages() {
	var giftcount = document.getElementById("count").value;
	var delids = "";
	if(giftcount>0) {
		for(var i=1;i<=giftcount;i++) {
			var chkid = "chk_id_"+i;			
			if(document.getElementById(chkid).checked==true) {
				if(delids=="") {
					delids = document.getElementById(chkid).value;
				}else {
					delids = delids+","+document.getElementById(chkid).value;
				}
			}
		}
		if(delids!="") {
			if(confirm("Are you sure to delete the selected gift(s)?")) {
				document.getElementById("delids").value =delids;		
				document.form1.submit();
				return true; 		
			}else {
				return false;
			}
		}else {
			alert("Please select gift(s) to delete");
			return false;
		}
	}
	return false;
}
function cmsPageValidate() 
{
	var form	= document.form1;
	var newpage = form.newpage.value;
	if(TextValidate(form.PageTitle,"Page Name")== false) { return false;}
	if(SecurityValidate(form.PageTitle,"Page Name")== false) { return false;}
	if(SecurityValidate(form.content,"Content")== false) { return false;}	
	var Pagecontentid = form.Pagecontentid.value;
	form.action = "editPages.php?code=pages&Pagecontentid="+Pagecontentid;
	form.submit();
	return true;

}


function getHelpPageData(helpval)
{
	var form	= document.form1;
	form.action= "editHelpPages.php?code=pages&Pagecontentid="+helpval;
	form.submit();
}
function resetCMSSearchFields()
{
	var form	= document.form1;
	form.Name.value = "";
	form.EmailID.value = "";
	form.Country.value = "";
	form.Online.options[0].selected = true;
	form.user_verification_status.options[0].selected = true;
	form.status.options[0].selected = true;
	return false;
	
}
function CollectCC() {

	var ccvalue = document.forms[0].cc;
	var txt="";
	for (i=0;i<ccvalue.length;++ i){
		if (ccvalue[i].checked){
			if(txt=="")	{
				txt=ccvalue[i].value
			}else {
				txt=txt +","+ccvalue[i].value;
			}
		}
	}
	document.getElementById("ccvalue").value = txt;
}
function CollectBCC() {

	var bccvalue = document.forms[0].bcc;
	var txt="";
	for (i=0;i<bccvalue.length;++ i){
		if (bccvalue[i].checked){
			if(txt=="")	{
				txt=bccvalue[i].value
			}else {
				txt=txt +","+bccvalue[i].value;
			}
		}
	}
	document.getElementById("bccvalue").value = txt;
}
function cmsHelpPageValidate() 
{
	var form	= document.form1;
	if(SelectValidate(form.PageSubTitleId,"Title")== false) { return false;}
	if(SecurityValidate(form.content,"Content")== false) { return false;}	
	form.actiontype.value = "1";
	var helpval = form.PageSubTitleId.value;
	form.action= "editHelpPages.php?code=pages&Pagecontentid="+helpval;
	form.submit();
	return true;

}
function  checkEnterCMSLoginSubmit(e){ //e is event object passed from function invocation
	var characterCode //literal character code will be stored in this variable
	
	if(e && e.which){ //if which property of event object is supported (NN4)
	e = e
	characterCode = e.which //character code is contained in NN4's which property
	}
	else{
	//e = event
	characterCode = e.keyCode //character code is contained in IE's keyCode property
	}
	
	if(characterCode == 13){ //if generated character code is equal to ascii 13 (if enter key)
			validateadminlogin();
		
	}
}
function OnChangeLimit(combo,combo1) {
	document.getElementById(combo1).value = document.getElementById(combo).value;
	cmsSearchFormSubmit();
}

function textLimit(limitField,limitNum) {
	if (limitField.value.length > limitNum) {
        limitField.value = limitField.value.substring(0, limitNum);
    } 
}

function limitText(limitField, limitNum) {
    if (limitField.value.length > limitNum) {
        limitField.value = limitField.value.substring(0, limitNum);
    } 
}

