//Check email validation
function ValidEmail(elementName)
{
	var eValid = new RegExp();
	eValid.compile("^[A-Za-z0-9-._]+@[A-Za-z0-9-._]+.[A-Za-z.]+.[A-Za-z.]+$"); // email validation Regex
	
	if(!eValid.test(elementName)) {
		return false;
	}  else {
		return true;
	}
}



function trim(par)
{
	var y = par.length;
	var ret = '';
	var ex=0;
	var bl=0;
	for (i=0;i<y;i++)
	{
		if (par.charAt(i) == ' ')
			bl = bl+1
		else
		{
			ret=ret+par.charAt(i);
			ex = ex+1
		}
	}

	if(par == ' ')
		return true;
	else if (bl==y)
		return true;
	else 
		return false;
}
 
//ajax function.....load contest entries..contest page
function ajax_displayContestEntries(contestId, pageLimit)
{
	if (contestId > 0) {
		sortField = document.sortEntries.sortField.value;
		xajax_displayContestEntries(contestId, sortField, pageLimit);
	}
}

//ajax function.....load contest entries..rank page
function ajax_rankContestEntries(contestId,pageLimit)
{
	if (contestId > 0) 
		xajax_rankContestEntries(contestId,pageLimit);
}

//ajax function.....rank this entry
function rankIt(entryId,contestId,designerId,busName) 
{
	//alert(busName+"bus name")
	//alert();
	rankOption = document.getElementById(entryId).value;
	xajax_rankIt(entryId, contestId, designerId, rankOption);
	//document.frmRank.action = "http://localhost/slogan/slogan_new/slogan/rankEntries.php?id="+contestId+"&busName="+busName
	document.frmRank.action = "http://www.sloganslingers.com/rankEntries.php?id="+contestId+"&busName="+busName;

	setTimeout("window.document.frmRank.submit()",100);	

}
//ajax function.....list my entries
function ajax_myEntries(pageLimit) 
{
	sortField = document.entriesForm.myEntries.value;
	xajax_myEntries(sortField,pageLimit);
}
//withdraw entry
function ajax_withdrawEntry(entryId,logoImage,logoPath,entryOrder,contestId)
{
	if (confirm("Are you sure, you want to withdraw your entry?")) {
		xajax_withdrawEntry(entryId,logoImage,logoPath,entryOrder,contestId);
		xajax_myEntries("rank");
	}
}
//entires for particular contest by a designer
function ajax_contestEntriesByDesigner(did,cid, pageLimit)
{
	xajax_contestEntriesByDesigner(did,cid,pageLimit);
}
//all entires by a designer
function ajax_allEntriesByDesigner(did,pageLimit)
{
	sortType = document.designerPortfolio.sortEntries.value;
	sortIndustry = document.designerPortfolio.industry.value;
	xajax_allEntriesByDesigner(did,sortType,sortIndustry,pageLimit);
}
//display portfolio
function ajax_displayPortfolio(pageLimit)
{
	selectedIndustry = document.portfolio.industry.value;
	xajax_displayPortfolio(selectedIndustry,pageLimit);
}
//display portfolio on index page
function ajax_displayWonLogos(totalLogo)
{
	xajax_displayWonLogos(totalLogo);
}
//add comment by logged in member
function ajax_addContestComment()
{
	contestId = document.contestViewForm.contestId.value;
	comment = document.contestViewForm.comment.value;
	if (contestId > 0 && comment != "") {
		xajax_addContestComment(contestId,comment);
	}
}

<!--
//Disable right mouse click Script
//By Maximus (maximus@nsimail.com) w/ mods by DynamicDrive
//For full source code, visit http://www.dynamicdrive.com

//var message="Function Disabled!";
function clickIE4()
{
	if (event.button==2){
		return false;
	}
}

function clickNS4(e)
{
	if (document.layers||document.getElementById&&!document.all){
		if (e.which==2||e.which==3){
			return false;
		}
	}
}

function checkNum(obj,feesContest) 
{

	var constPrice = obj;

	if (isNaN(obj.value)) {
			alert('Please enter numeric values');
			obj.value = '';
			return false;
	}
	
	if (obj.value.length > 4 && obj.value < 200) {
			
			obj.value = '';
			return false;
	}

	if (obj.value > 1000) {
			obj.value = '';
			return false;
	}

	var calFees = (obj.value*feesContest)/100;
	document.getElementById('amountAfterTax').innerHTML = calFees;
	document.getElementById('totAmount').innerHTML =  Number(constPrice.value) + Number(calFees);
	document.frmStartalogo.taxAmount.value = calFees;
	document.frmStartalogo.totPrizeAmount.value =  Number(constPrice.value) + Number(calFees);
	
	if(document.frmStartalogo.isPrivate.checked == true) {
		document.getElementById('totAmount').innerHTML =  Number(constPrice.value) + Number(calFees)+50;
		document.frmStartalogo.totPrizeAmount.value =  Number(constPrice.value) + Number(calFees)+50;
	}

	return true;
}


function addPrivate() 
{
	
	if (document.frmStartalogo.isPrivate.checked == true) {
		document.getElementById('privateAmount').innerHTML = 50.00;
		document.getElementById('totAmount').innerHTML = (Number(document.frmStartalogo.prizeAmount.value) + Number(document.getElementById('amountAfterTax').innerHTML)) + 50;
	
	} else {
	
		document.getElementById('privateAmount').innerHTML = 0.00;
		document.getElementById('totAmount').innerHTML = (Number(document.frmStartalogo.prizeAmount.value) + Number(document.getElementById('amountAfterTax').innerHTML));

	}	
}


//report spam message by members 
function ajax_reportSpamMessage(messageId)
{
	msgData = document.frmSpam.spamMessage.value;
	xajax_reportSpamMessage(messageId,msgData);	
}

function ajax_sendPMMessage(receiverId,entryorder)
{
	var4 = "privateMessage_"+entryorder;
	msgData = document.getElementById(var4).value;
	xajax_sendPMMessage(receiverId,msgData,entryorder);	
}


 function checkAvailabe()
{	
	var uName = document.designerReg.userName.value;
	//alert(uName+"uername");
	if(uName != "") {
		document.getElementById('checkImg').style.display = 'block';	
		setTimeout("doSomeThing()",500);
	}
	
}

function doSomeThing()
{
	var uName = document.designerReg.userName.value;
	if(uName != "") {
		xajax_userNameAvailable(uName);
	}
	document.getElementById('checkImg').style.display = 'none';
}



 function checkemail()
{	
	var uEmail = document.designerReg.emailId.value;
	//alert(uName+"uername");
	if(uEmail != "") {
		document.getElementById('checkImg1').style.display = 'block';	
		setTimeout("doEmailCheck()",500);
	}
	
}

function doEmailCheck()
{
	var uEmail = document.designerReg.emailId.value;
	if(uEmail != "") {
		xajax_emailAddressAvailable(uEmail);
	}
	document.getElementById('checkImg1').style.display = 'none';
}



function checkPassword()
{
	var psd = document.designerReg.password.value;
	if(psd != "") {
		xajax_passStrength(psd);
	}

}