/////////////////////////
//to validate email-id //
/////////////////////////
function isValidEmail(eml)
{
	//declare the required variables
	var mint_len;
	var mstr_eml=eml;
	var mint_at=0;
	var mint_atnum=0;
	var mint_dot=0;
	var mint_dotnum=0;
	
	mint_len=eml.length; //takes the length of the email address entered
	
	//checking for the symbol single quote. If found replace it with its html code
	if (mstr_eml.indexOf("'")!=-1)
	{
		mstr_eml=mstr_eml.replace("'","&#39;");
	}
	
	//checking for the (@) & (.) symbol
	for(var iloop=0;iloop<mint_len;iloop++)
	{
		if(mstr_eml.charAt(iloop)=="@")
		{
			mint_at=iloop+1;
			mint_atnum=mint_atnum+1;
		}
		if(mstr_eml.charAt(iloop)==".")
		{
			mint_dot=iloop+1;
			mint_dotnum=mint_dotnum+1;
		}
	}
	
	//if nothing entered in the field
	if (mstr_eml=="")
	{
		return false
	}
	
	//if @ entered more than once & dot (.) entered more than 4 times
	else if((mint_atnum!=1)||(mint_dotnum>4)||((mint_dot-mint_at)<2)||((mint_len-mint_dot)<2)||(mint_at<3))
	{
		return false;
	}
	
	//if any blank space is entered in the email address
	else if (mstr_eml.indexOf(" ")!=-1)
	{
		return false;
	}
	return true;
}

////////////////////////////////
//to ensure field is not blank//
////////////////////////////////
function isBlankField(txt)
{
	var mint_txt=txt.length; //Takes the total length of the value entered
	var mstr_txt=txt;
	var mint_count=0;
	
	//checking with each character for space
	for(var iloop=0;iloop<mint_txt;iloop++)
	{
		if(mstr_txt.charAt(iloop)==" ")
		{
			mint_count=mint_count+1;
		}
	}
	
	//if nothing entered in the field
	if (txt=="")
	{
		return false;
	}
	
	//if only spaces are entered
	else if (mint_count==mint_txt)
	{
		return false;
	}
	else
	{
		return true;
	}
}

////////////////////////////////////////////
//to replace double quotes by single quote//
////////////////////////////////////////////
function doubleQuotesReplace()
{
	var intRootCounter;
		
	for(intRootCounter = 0; intRootCounter<document.frmMain.elements.length; intRootCounter++)
	{
		if (((document.frmMain.elements[intRootCounter].type) == "text") || ((document.frmMain.elements[intRootCounter].type) == "textarea"))
		{
			var reg=/"/gi;
			document.frmMain.elements[intRootCounter].value = (document.frmMain.elements[intRootCounter].value).replace(reg,"'");
		}
	}
}

///////////////////////////
//to validate Website URL//
///////////////////////////
function isValidURL(url)
{
	if (url.indexOf("http://www.") == "-1")
		return false;
	else
		return true;
	return true;
}

//////////////////////////
//to disable right click//
//////////////////////////
if (window.Event) // Only Netscape will have the CAPITAL E.
	document.captureEvents(Event.MOUSEUP); // catch the mouse up event
 
function nocontextmenu()  // this function only applies to IE4, ignored otherwise.
{
	event.cancelBubble = true
	event.returnValue = false;
	return false;
}
 
function norightclick(e) // This function is used by all others
{
	if (window.Event) // again, IE or NAV?
	{
		if (e.which == 2 || e.which == 3)
		return false;
	}
	else
	if (event.button == 2 || event.button == 3)
	{
		event.cancelBubble = true
		event.returnValue = false;
		return false;
	}
}
 
document.oncontextmenu = nocontextmenu;  // for IE5+
document.onmousedown = norightclick;  // for all others