
function confirmMsg(msg){
	if(!confirm(msg)){
		return false;

	} else {
		return true;

	}
}
// JavaScript Document
startList = function() {

	// code for IE
	if(!document.body.currentStyle) return;
	var subs = document.getElementsByName('submenu');
	for(var i=0; i<subs.length; i++) {
		var li = subs[i].parentNode;
		if(li && li.lastChild.style) {
			li.onmouseover = function() {
				this.lastChild.style.visibility = 'visible';
			}
			li.onmouseout = function() {
				this.lastChild.style.visibility = 'hidden';
			}
		}
	}
}
window.onload=startList;

function login_validate(){
var txtUsername=document.Login.txtUsername.value;
	 if(txtUsername == "")
	 {
			 alert("User name  is empty");
			 document.Login.txtUsername.focus();
			 return false;
	}
	var txtPassword=document.Login.txtPassword.value;
	 if(txtPassword == "")
	 {
			 alert("Password  is empty");
			 document.Login.txtPassword.focus();
			 return false;
	 }
	document.Login.Submit.disabled=true;
	return true;
}

function adv_validate(n)
{
	var no = n;
	var total=0;
		for(var i=0; i < document.form1.qty.length; i++)
		{
			if(document.form1.qty[i].checked)
			total = parseInt(total) + 1;
		}
		if(total == 0)
		{
		alert("Please select any one of the package category.");
		return false;
		}
	return true;
}

/*function submitdesign_validate()
{
	if(document.form1.email.value == "")
	{
	   alert("Please enter the contact email address");
	   document.form1.email.focus();
	   return false;
	}
	if(!validateEmail(document.form1.email.value,1,1))
	{
	   document.form1.email.focus();
	   return false;
	}
	if(document.form1.file1.value == "")
	{
		alert("Please upload the file1");
		document.form1.file1.focus();
		return false;
	}
	var CorrectFileFlag  = 0;
	var where_is_mytool=document.form1.file1.value;
	var mytool_array=where_is_mytool.split(".");
	var lastvalue=0;
	lastvalue=mytool_array.length - 1;
	var filevalue=mytool_array[lastvalue];
	var filtypes = new Array('htm','HTM','html','HTML','php','PHP','jpg','JPG','jpeg','JPEG','gif','GIF','bmp','BMP','png','PNG','ico','ICO','css','CSS','js','JS','txt','TXT','wm','wmv','asf','rm','ram','mpg','mov','mpeg','avi','swf','WM','WMV','ASF','RM','RAM','MPG','MOV','MPEG','AVI','SWF');
	filetypeval = filtypes.length;
	for(i=0; i<=filetypeval; i++)
	{
		if(CorrectFileFlag == 0) {
			if((filevalue == filtypes[i]))
			{
			   CorrectFileFlag = 1;
			}
		}
	}
	if((CorrectFileFlag == 0) && document.form1.file1.value != ''){
		alert("The file selected is not allowed for the Type indicated. Please select the following file type.( .htm,.html,.php,.jpg, .jpeg, .gif, .bmp, .png, .ico, .css, .js,.txt,.wm, .wmv, .asf, .rm, .ram, .mpg, .mov, .mpeg, .avi, .swf)");
	   document.form1.file1.focus();
	   return false;
	}
	  
}*/

function createblog_validate()
{
  if(document.frm_blog.txt_blogname.value == "")
	{
	   alert("Please enter the answer");
	   document.frm_blog.txt_blogname.focus();
	   return false;
	}
	
	var CorrectFileFlag  = 0;
	var where_is_mytool=document.frm_blog.image.value;
	var mytool_array=where_is_mytool.split(".");
	var lastvalue=0;
	lastvalue=mytool_array.length - 1;
	var filevalue=mytool_array[lastvalue];
	var filtypes = new Array('jpg','JPG','jpeg','JPEG','gif','GIF','bmp','BMP','png','PNG');
	filetypeval = filtypes.length;
	for(i=0; i<=filetypeval; i++)
	{
		if(CorrectFileFlag == 0) {
			if((filevalue == filtypes[i]))
			{
			   CorrectFileFlag = 1;
			}
		}
	}
	if((CorrectFileFlag == 0) && document.frm_blog.ftype[0].checked){
		alert("The file selected is not allowed for the Type indicated. Please select the following Image file type.( .jpg, .jpeg, .gif, .bmp, .png)");
	   document.frm_blog.image.focus();
	   return false;
	}
	  
	var AudioCorrectFileFlag  = 0;
	var Audiowhere_is_mytool=document.frm_blog.txtaudio.value;
	var Audiomytool_array=Audiowhere_is_mytool.split(".");
	var Audiolastvalue=0;
	Audiolastvalue=Audiomytool_array.length - 1;
	var Audiofilevalue=Audiomytool_array[Audiolastvalue];
	var Audiofiltypes = new Array('wav','mp3','wma','midi','au','WAV','MP3','WMA','MIDI','AU');
	Audiofiletypeval = Audiofiltypes.length;
	for(j=0; j<=Audiofiletypeval; j++)
	{
		if(AudioCorrectFileFlag == 0) {
			if((Audiofilevalue == Audiofiltypes[j]))
			{
			   AudioCorrectFileFlag = 1;
			}
		}
	}
		if((AudioCorrectFileFlag == 0) && document.frm_blog.ftype[2].checked){
		   alert("The file selected is not allowed for the Type indicated. Please select the following Audio file type.( .wav, .mp3, .wma, .midi, .au)");
		   document.frm_blog.txtaudio.focus();
		   return false;
		}
	
	var VideoCorrectFileFlag  = 0;
	var Videowhere_is_mytool=document.frm_blog.txtvideo.value;
	var Videomytool_array=Videowhere_is_mytool.split(".");
	var Videolastvalue=0;
	Videolastvalue=Videomytool_array.length - 1;
	var Videofilevalue=Videomytool_array[Videolastvalue];
	var Videofiltypes = new Array('wm','wmv','asf','rm','ram','mpg','mov','mpeg','avi','swf','WM','WMV','ASF','RM','RAM','MPG','MOV','MPEG','AVI','SWF');
	Videofiletypeval = Videofiltypes.length;
	for(k=0; k<=Videofiletypeval; k++)
	{
		if(VideoCorrectFileFlag == 0) {
			if((Videofilevalue == Videofiltypes[k]))
			{
			   VideoCorrectFileFlag = 1;
			}
		}
	}
		if((VideoCorrectFileFlag == 0) && document.frm_blog.ftype[1].checked){
		   alert("The file selected is not allowed for the Type indicated. Please select the following video file type.( .wm, .wmv, .asf, .rm, .ram, .mpg, .mov, .mpeg, .avi, .swf)");
		   document.frm_blog.txtvideo.focus();
		   return false;
		}
	if(document.frm_blog.txtshort.value == "")
	{
	   alert("Please enter the short description");
	   document.frm_blog.txtshort.focus();
	   return false;
	}
	document.frm_blog.cmd_Submit.disabled=true;
	return true;
}

function showdetails(){
	if(document.frm_blog.ftype[0].checked) 
	{
		shipname=document.getElementById("secondapplicant");
		if(shipname){
		shipname.style.display="block";
		shipname.style.visibility="visible";
		}
		shipname1=document.getElementById("thirdapplicant");
		if(shipname1){
			shipname1.style.display="none";
			shipname1.style.visibility="hidden";
		}
		shipname11=document.getElementById("firstapplicant");
		if(shipname11){
			shipname11.style.display="none";
			shipname11.style.visibility="hidden";
		}
	}
	if(document.frm_blog.ftype[1].checked) 
	{
		shipname=document.getElementById("thirdapplicant");
		    if(shipname){
			shipname.style.display="block";
			shipname.style.visibility="visible";
			}
           shipname1=document.getElementById("secondapplicant");
			if(shipname1){
			shipname1.style.display="none";
			shipname1.style.visibility="hidden";
			}
			shipname11=document.getElementById("firstapplicant");
		    if(shipname11){
			shipname11.style.display="none";
			shipname11.style.visibility="hidden";
			}
	}
	if(document.frm_blog.ftype[2].checked) 
	{
		shipname=document.getElementById("firstapplicant");
		    if(shipname){
			shipname.style.display="block";
			shipname.style.visibility="visible";
			}
           shipname1=document.getElementById("secondapplicant");
			if(shipname1){
			shipname1.style.display="none";
			shipname1.style.visibility="hidden";
			}
			shipname11=document.getElementById("thirdapplicant");
		    if(shipname11){
			shipname11.style.display="none";
			shipname11.style.visibility="hidden";
			}
	}
}

function showimgdetails(){
	if(document.postcomment.ftype[0].checked) 
	{
		shipname=document.getElementById("secondapplicant");
		if(shipname){
		shipname.style.display="block";
		shipname.style.visibility="visible";
		}
		shipname1=document.getElementById("thirdapplicant");
		if(shipname1){
			shipname1.style.display="none";
			shipname1.style.visibility="hidden";
		}
		shipname11=document.getElementById("firstapplicant");
		if(shipname11){
			shipname11.style.display="none";
			shipname11.style.visibility="hidden";
		}
	}
	if(document.postcomment.ftype[1].checked) 
	{
		shipname=document.getElementById("thirdapplicant");
		    if(shipname){
			shipname.style.display="block";
			shipname.style.visibility="visible";
			}
           shipname1=document.getElementById("secondapplicant");
			if(shipname1){
			shipname1.style.display="none";
			shipname1.style.visibility="hidden";
			}
			shipname11=document.getElementById("firstapplicant");
		    if(shipname11){
			shipname11.style.display="none";
			shipname11.style.visibility="hidden";
			}
	}
	if(document.postcomment.ftype[2].checked) 
	{
		shipname=document.getElementById("firstapplicant");
		    if(shipname){
			shipname.style.display="block";
			shipname.style.visibility="visible";
			}
           shipname1=document.getElementById("secondapplicant");
			if(shipname1){
			shipname1.style.display="none";
			shipname1.style.visibility="hidden";
			}
			shipname11=document.getElementById("thirdapplicant");
		    if(shipname11){
			shipname11.style.display="none";
			shipname11.style.visibility="hidden";
			}
	}
}

function comment_validate()
{
	var CorrectFileFlag  = 0;
	var where_is_mytool=document.postcomment.image.value;
	var mytool_array=where_is_mytool.split(".");
	var lastvalue=0;
	lastvalue=mytool_array.length - 1;
	var filevalue=mytool_array[lastvalue];
	var filtypes = new Array('jpg','JPG','jpeg','JPEG','gif','GIF','bmp','BMP','png','PNG');
	filetypeval = filtypes.length;
	for(i=0; i<=filetypeval; i++)
	{
		if(CorrectFileFlag == 0) {
			if((filevalue == filtypes[i]))
			{
			   CorrectFileFlag = 1;
			}
		}
	}
	if((CorrectFileFlag == 0) && document.postcomment.ftype[0].checked){
		alert("The file selected is not allowed for the Type indicated. Please select the following Image file type.( .jpg, .jpeg, .gif, .bmp, .png)");
	   document.postcomment.image.focus();
	   return false;
	}
	  
	var AudioCorrectFileFlag  = 0;
	var Audiowhere_is_mytool=document.postcomment.txtaudio.value;
	var Audiomytool_array=Audiowhere_is_mytool.split(".");
	var Audiolastvalue=0;
	Audiolastvalue=Audiomytool_array.length - 1;
	var Audiofilevalue=Audiomytool_array[Audiolastvalue];
	var Audiofiltypes = new Array('wav','mp3','wma','midi','au','WAV','MP3','WMA','MIDI','AU');
	Audiofiletypeval = Audiofiltypes.length;
	for(j=0; j<=Audiofiletypeval; j++)
	{
		if(AudioCorrectFileFlag == 0) {
			if((Audiofilevalue == Audiofiltypes[j]))
			{
			   AudioCorrectFileFlag = 1;
			}
		}
	}
		if((AudioCorrectFileFlag == 0) && document.postcomment.ftype[2].checked){
		   alert("The file selected is not allowed for the Type indicated. Please select the following Audio file type.( .wav, .mp3, .wma, .midi, .au)");
		   document.postcomment.txtaudio.focus();
		   return false;
		}
	
	var VideoCorrectFileFlag  = 0;
	var Videowhere_is_mytool=document.postcomment.txtvideo.value;
	var Videomytool_array=Videowhere_is_mytool.split(".");
	var Videolastvalue=0;
	Videolastvalue=Videomytool_array.length - 1;
	var Videofilevalue=Videomytool_array[Videolastvalue];
	var Videofiltypes = new Array('wm','wmv','asf','rm','ram','mpg','mov','mpeg','avi','swf','WM','WMV','ASF','RM','RAM','MPG','MOV','MPEG','AVI','SWF');
	Videofiletypeval = Videofiltypes.length;
	for(k=0; k<=Videofiletypeval; k++)
	{
		if(VideoCorrectFileFlag == 0) {
			if((Videofilevalue == Videofiltypes[k]))
			{
			   VideoCorrectFileFlag = 1;
			}
		}
	}
		if((VideoCorrectFileFlag == 0) && document.postcomment.ftype[1].checked){
		   alert("The file selected is not allowed for the Type indicated. Please select the following video file type.( .wm, .wmv, .asf, .rm, .ram, .mpg, .mov, .mpeg, .avi, .swf)");
		   document.postcomment.txtvideo.focus();
		   return false;
		}
	
	document.postcomment.cmdSubmit.disabled=true;
	return true;
}

function suggest_validate()
{
	if(document.form1.txtname.value == "")
	{
		alert("Enter your name");
		document.form1.txtname.focus();
		return false;
	}
	if(document.form1.txtemail.value == "")
	{
		alert("Enter the email address");
		document.form1.txtemail.focus();
		return false;
	}
	if(!validateEmail(document.form1.txtemail.value,1,1))
	{
	   document.form1.txtemail.focus();
	   return false;
	}
	if(document.form1.txttopic.value == "")
	{
		alert("Enter the topic name");
		document.form1.txttopic.focus();
		return false;
	}
	document.form1.cmdSubmit.disabled=true;
	return true;
}

function checkwhere()
{
	SearchIn	=	document.searchform.SearchIn.value;
	if(SearchIn == "topic" || SearchIn == "username")
	{
		document.searchform.action	=	"search_topics.php";
		document.searchform.submit();
	}
	else
	{
		document.searchform.action	=	"search_forum.php";
		document.searchform.submit();
	}
}
function poptastic(url)
{
	newwindow=window.open(url,'ImageDisplay','height=400,width=600,left=0,top=0,resizable=yes,scrollbars=yes');
	if (window.focus) {newwindow.focus()}
}
function poplinks(url)
{
	newwindow=window.open(url,'ImageDisplay','height=460,width=600,left=0,top=0,resizable=yes,scrollbars=yes');
	if (window.focus) {newwindow.focus()}
}

function checkout_validate(){
	if(document.checkout.name.value == "")
	{
	   alert("Please enter the name");
	   document.checkout.name.focus();
	   return false;
	}
	if(document.checkout.email.value == "")
	{
	   alert("Please enter the email address");
	   document.checkout.email.focus();
	   return false;
	}
	if (!validateEmail(document.checkout.email.value,1,1)) 
	{
		document.checkout.email.focus();
		return false;
	}
	document.checkout.Submit.disabled=true;
	return true;
}

// simple test for URL format
function testURL(form, Ctrl) {
	if (Ctrl.value == "" || Ctrl.value.indexOf("http://",0) == -1) {
		validatePrompt (Ctrl, "Please provide a valid URL")
		return (false);
	} else
		return (true);
}

function answer_validate(){
	
	
	
	if(document.form1.anstitle.value == "")
	{
	   alert("Please enter the answer");
	   document.form1.anstitle.focus();
	   return false;
	}
	
	var CorrectFileFlag  = 0;
	var where_is_mytool=document.form1.image.value;
	var mytool_array=where_is_mytool.split(".");
	var lastvalue=0;
	lastvalue=mytool_array.length - 1;
	var filevalue=mytool_array[lastvalue];
	var filtypes = new Array('jpg','JPG','jpeg','JPEG','gif','GIF','bmp','BMP','png','PNG');
	filetypeval = filtypes.length;
	for(i=0; i<=filetypeval; i++)
	{
		if(CorrectFileFlag == 0) {
			if((filevalue == filtypes[i]))
			{
			   CorrectFileFlag = 1;
			}
		}
	}
	if((CorrectFileFlag == 0) && document.form1.ftype[0].checked){
		alert("The file selected is not allowed for the Type indicated. Please select the following Image file type.( .jpg, .jpeg, .gif, .bmp, .png)");
	   document.form1.image.focus();
	   return false;
	}
	  
	var AudioCorrectFileFlag  = 0;
	var Audiowhere_is_mytool=document.form1.txtaudio.value;
	var Audiomytool_array=Audiowhere_is_mytool.split(".");
	var Audiolastvalue=0;
	Audiolastvalue=Audiomytool_array.length - 1;
	var Audiofilevalue=Audiomytool_array[Audiolastvalue];
	var Audiofiltypes = new Array('wav','mp3','wma','midi','au','WAV','MP3','WMA','MIDI','AU');
	Audiofiletypeval = Audiofiltypes.length;
	for(j=0; j<=Audiofiletypeval; j++)
	{
		if(AudioCorrectFileFlag == 0) {
			if((Audiofilevalue == Audiofiltypes[j]))
			{
			   AudioCorrectFileFlag = 1;
			}
		}
	}
		if((AudioCorrectFileFlag == 0) && document.form1.ftype[2].checked){
		   alert("The file selected is not allowed for the Type indicated. Please select the following Audio file type.( .wav, .mp3, .wma, .midi, .au)");
		   document.form1.txtaudio.focus();
		   return false;
		}
	
	var VideoCorrectFileFlag  = 0;
	var Videowhere_is_mytool=document.form1.txtvideo.value;
	var Videomytool_array=Videowhere_is_mytool.split(".");
	var Videolastvalue=0;
	Videolastvalue=Videomytool_array.length - 1;
	var Videofilevalue=Videomytool_array[Videolastvalue];
	var Videofiltypes = new Array('wm','wmv','asf','rm','ram','mpg','mov','mpeg','avi','swf','WM','WMV','ASF','RM','RAM','MPG','MOV','MPEG','AVI','SWF');
	Videofiletypeval = Videofiltypes.length;
	for(k=0; k<=Videofiletypeval; k++)
	{
		if(VideoCorrectFileFlag == 0) {
			if((Videofilevalue == Videofiltypes[k]))
			{
			   VideoCorrectFileFlag = 1;
			}
		}
	}
		if((VideoCorrectFileFlag == 0) && document.form1.ftype[1].checked){
		   alert("The file selected is not allowed for the Type indicated. Please select the following video file type.( .wm, .wmv, .asf, .rm, .ram, .mpg, .mov, .mpeg, .avi, .swf)");
		   document.form1.txtvideo.focus();
		   return false;
		}
	document.form1.Submit.disabled=true;
	//this.elements['Submit'].disabled=true;
	return true;
	/*if (!testURL(form1, form1.linkto)){ return false};
	if(document.form1.linkto.value != "")
	{
	re = /^(file|http):\/\/\S+\.(com|net|org|info|biz|ws|us|tv|cc|in|cd|nw|ca|edu|gov|co.uk|co.in|jp|cn|de)$/i
	if (!(re.test(document.form1.linkto.value))) 
	{
		alert ("Invalid URL.");
		document.form1.linkto.focus();
	 	return false;
	}
	}*/
	
}

function anspostcomment_validate()
{
	document.form1.Submit.disabled=true;
	return true;
}
function post_topic(){
	if(document.NewTopicForm.varSubject.value == "")
	{
	   alert("Please enter the subject");
	   document.NewTopicForm.varSubject.focus();
	   return false;
	}
	document.NewTopicForm.cmdSubmit.disabled=true;
	return true;
}
function post_replyvalidate()
{
	document.reply.cmdSubmit.disabled=true;
	return true;
}

function validatePrompt (Ctrl, PromptStr) {
	alert (PromptStr)
	Ctrl.focus();
	return;
}

function forget_validate()
{
	if(document.form1_reg.txtEmail.value == "")
	{
	   alert("Please enter the email address");
	   document.form1_reg.txtEmail.focus();
	   return false;
	}
	if(!validateEmail(document.form1_reg.txtEmail.value,1,1))
	{
	   document.form1_reg.txtEmail.focus();
	   return false;
	}
}

function register_validate()
{
	if(document.frm_register.txtUser.value == "")
	{
	   alert("Please enter the username");
	   document.frm_register.txtUser.focus();
	   return false;
	}
	if(!isString(document.frm_register.txtUser.value)){
		alert("No special characters in username allowed, only alphanumeric characters!");
		document.frm_register.txtUser.focus();
		return false;
	}
	if(document.frm_register.txtPassword.value == "")
	{
	   alert("Please enter the password");
	   document.frm_register.txtPassword.focus();
	   return false;
	}
	if(document.frm_register.txtConfirmPassword.value == "")
	{
	   alert("Please enter the confirm password");
	   document.frm_register.txtConfirmPassword.focus();
	   return false;
	}
	if(document.frm_register.txtPassword.value != document.frm_register.txtConfirmPassword.value)
	{
	   alert("Please enter the same password");
	   document.frm_register.txtConfirmPassword.value="";
	   document.frm_register.txtConfirmPassword.focus();
	   return false;
	}
	if(document.frm_register.txtFirst.value == "")
	{
	   alert("Please enter the first name");
	   document.frm_register.txtFirst.focus();
	   return false;
	}
	if(document.frm_register.txtLast.value == "")
	{
	   alert("Please enter the last name");
	   document.frm_register.txtLast.focus();
	   return false;
	}
	if(document.frm_register.txtabme.value == "")
	{
	   alert("Please enter the about me");
	   document.frm_register.txtabme.focus();
	   return false;
	}
	if(document.frm_register.txtemail.value == "")
	{
	   alert("Please enter the email address");
	   document.frm_register.txtemail.focus();
	   return false;
	}
	if(!validateEmail(document.frm_register.txtemail.value,1,1))
	{
	   document.frm_register.txtemail.focus();
	   return false;
	}
	if(document.frm_register.recaptcha_response_field.value == "")
	{
	   alert("Please enter the text shown");
	   document.frm_register.recaptcha_response_field.focus();
	   return false;
	}
	document.frm_register.cmd_Submit.disabled=true;
	return true;
}

function openwin(){
	document.viewcart.action="modifycart.php";
	document.viewcart.submit();
}
function opencheck(){
	document.viewcart.action="checkout.php";
	document.viewcart.submit();
}
function openwindow(){
	document.viewcart.action="deletecart.php";
	document.viewcart.submit();
}

function post_answer(cid,sid,tid)
{
	document.form1.action="viewpostanswerdetails.php?catid="+cid+"&subcatid="+sid+"&topicid="+tid+"";
	document.form1.submit();
}

function showdeli(){
	if(!(document.checkout.chkDelivery.checked)){
		delistyle=document.getElementById("delivery");
		if(delistyle){
		delistyle.style.display="block";
		delistyle.style.visibility="visible";
		}				
	}
	else
	{
		delistyle=document.getElementById("delivery");
		if(delistyle){
		delistyle.style.display="none";
		delistyle.style.visibility="hidden";
		}
	}
}
	
//Email Validation Script
function validateEmail(addr,man,db) {
	if (addr == '' && man) {
	   if (db) alert('Email address is mandatory');
	   return false;
	}
	var invalidChars = '\/\'\\ ";:?!()[]\{\}^|';
	for (i=0; i<invalidChars.length; i++) {
	   if (addr.indexOf(invalidChars.charAt(i),0) > -1) {
		  if (db) alert('Email address contains invalid characters');
		  return false;
	   }
	}
	for (i=0; i<addr.length; i++) {
	   if (addr.charCodeAt(i)>127) {
		  if (db) alert("Email address contains non ascii characters.");
		  return false;
	   }
	}

	var atPos = addr.indexOf('@',0);
	if (atPos == -1) {
	   if (db) alert('Email address must contain an @');
	   return false;
	}
	if (atPos == 0) {
	   if (db) alert('Email address must not start with @');
	   return false;
	}
	if (addr.indexOf('@', atPos + 1) > - 1) {
	   if (db) alert('Email address must contain only one @');
	   return false;
	}
	if (addr.indexOf('.', atPos) == -1) {
	   if (db) alert('Email address must contain a period in the domain name');
	   return false;
	}
	if (addr.indexOf('@.',0) != -1) {
	   if (db) alert('period must not immediately follow @ in email address');
	   return false;
	}
	if (addr.indexOf('.@',0) != -1){
	   if (db) alert('period must not immediately precede @ in email address');
	   return false;
	}
	if (addr.indexOf('..',0) != -1) {
	   if (db) alert('two periods must not be adjacent in email address');
	   return false;
	}
	var suffix = addr.substring(addr.lastIndexOf('.')+1);
	if (suffix.length != 2 && suffix != 'com' && suffix != 'net' && suffix != 'org' && suffix != 'edu' && suffix != 'int' && suffix != 'mil' && suffix != 'gov' & suffix != 'arpa' && suffix != 'biz' && suffix != 'aero' && suffix != 'name' && suffix != 'coop' && suffix != 'info' && suffix != 'pro' && suffix != 'museum') {
	   if (db) alert('invalid primary domain in email address');
	   return false;
	}
return true;
}

 //Function phone validation Script
// Declaring required variables
var digits = "0123456789";
// non-digit characters which are allowed in phone numbers
var phoneNumberDelimiters = "()- ";
// characters which are allowed in international phone numbers
// (a leading + is OK)
var validWorldPhoneChars = phoneNumberDelimiters + "+";
// Minimum no of digits in an international phone no.
var minDigitsInIPhoneNumber = 10;

function isInteger(s)
{   var i;
    for (i = 0; i < s.length; i++)
    {   
        // Check that current character is number.
        var c = s.charAt(i);
        if (((c < "0") || (c > "9"))) return false;
    }
    // All characters are numbers.
    return true;
}

function stripCharsInBag(s, bag)
{   var i;
    var returnString = "";
    // Search through string's characters one by one.
    // If character is not 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) returnString += c;
    }
    return returnString;
}

function checkInternationalPhone(strPhone){
s=stripCharsInBag(strPhone,validWorldPhoneChars);
return (isInteger(s) && s.length >= minDigitsInIPhoneNumber);
}
function isString (s) //Checks whether the string contains only alphabets, . and _
{  
	    var i;
		var bag="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890 "
	    for (i = 0; i < s.length; i++)
	    {   
	        var c = s.charAt(i);
	        if (bag.indexOf(c) == -1) return false;
	    }
	    return true;
}

var whitespace = " \t\n\r";

function suggestcomfrm_validate(){
	if(document.form1.business.value == "")
	{
		alert("Choose the Business Type");
		return false;
	}
	if(document.form1.txtcompany.value == "")
	{
		alert("Enter the Company name");
		document.form1.txtcompany.focus();
		return false;
	}
	var designtitle = document.form1.txtcompany.value;
	if(!isString(document.form1.txtcompany.value)){
		alert("No special characters in company name allowed, only alphanumeric characters!");
		document.form1.txtcompany.focus();
		return false;
	}
	if(document.form1.txtcompanyurl.value == "")
	{
		alert("Enter the Company URL");
		document.form1.txtcompanyurl.focus();
		return false;
	}
	if(document.form1.desc.value == "")
	{
		alert("Enter the Description");
		document.form1.desc.focus();
		return false;
	}
	if(document.form1.txtname.value == "")
	{
		alert("Enter Your Name ");
		document.form1.txtname.focus();
		return false;
	}
	if(document.form1.txtemail.value == "")
	{
		alert("Enter Your Email Address ");
		document.form1.txtemail.focus();
		return false;
	}
	if(!validateEmail(document.form1.txtemail.value,1,1))
	{
	   document.form1.txtemail.focus();
	   return false;
	}
//document.form1.Cmd_Submit.disabled=true;
	return true;
}












