// JavaScript Document
function setnewclass(id)
	{
		tabid="";
		tabid=id + "1";
		//alert(catid);
		document.getElementById(tabid).className = "selecttab_left";
		tabid=id + "2";
		document.getElementById(tabid).className = "selecttab_bg";
		tabid=id + "3";
		document.getElementById(tabid).className = "selecttab_right";
		//newClass="normtab_left";
		//oldClass="selecttab_left";
		
		//document.getElementById(id).className = newClass;
		document.getElementById(id).style.cursor='pointer';
		//document.getElementById(a1).className = newClass;
		//document.getElementById(a3).className = oldClass;		
		//alert ("call");

	}
	
	function setoldclass(id)
	{
		tabid="";
		tabid=id + "1";
		//alert(catid);
		document.getElementById(tabid).className = "normtab_left";
		tabid=id + "2";
		document.getElementById(tabid).className = "normtab_bg";
		tabid=id + "3";
		document.getElementById(tabid).className = "normtab_right";
		//newClass="normtab_left";
		//oldClass="selecttab_left";
		
		//document.getElementById(id).className = newClass;
		document.getElementById(id).style.cursor='pointer';
		//document.getElementById(a1).className = newClass;
		//document.getElementById(a3).className = oldClass;		
		//alert ("call 2");

	}
	
function isEmail(val)
{
	if(Trim(val,' ') == "")
	{
		alert("Please enter a Email!");
		return false;
	}
	else if (!(val.indexOf('\@') > -1))
	{
		alert("Email must contain a \@");
		return false;
	}
	else if (!(val.indexOf('.') > -1))
	{
		alert("Email must contain a '.' (dot)");
		return false;
	}
	else if (val.indexOf('\@') == (val.indexOf('.')-1))
	{
		alert("Email can't contain a \@ and '.' side by side");
		return false;
	}
	else if (val.indexOf('.') == (val.length-1))
	{
		alert("Email can't contain a '.' (dot) at the end");
		return false;
	}
	return true;
}

function Trim(inputString, removeChar) 
{
	var returnString = inputString;
	if (removeChar.length)
	{
	  while(''+returnString.charAt(0)==removeChar)
		{
		  returnString=returnString.substring(1,returnString.length);
		}
		while(''+returnString.charAt(returnString.length-1)==removeChar)
	  {
	    returnString=returnString.substring(0,returnString.length-1);
	  }
	}
	return returnString;
}

function IsNumeric2(sText)
{
   var ValidChars = "0123456789+- ";
   var IsNumber=true;
   var Char;

 
   for (i = 0; i < sText.length && IsNumber == true; i++) 
      { 
      Char = sText.charAt(i); 
      if (ValidChars.indexOf(Char) == -1) 
         {
         IsNumber = false;
         }
      }
	  return IsNumber;
}

function isContactFormOk(frm)
{
	if(Trim(frm.name.value," ")== "" )
	{
		alert("Please specify name.");
		frm.name.focus();
		return false;
	}
	if(Trim(frm.contact_no.value," ")== "" )
	{
		alert("Please Enter Phone Number.");
		frm.contact_no.focus();
		return false;
	}
	if(!IsNumeric2(frm.contact_no.value))
	{
		alert("Please Enter Valid Phone Number.");
		frm.contact_no.focus();
		return false;
	}
	if(!isEmail(frm.email.value))
	{
		frm.email.focus();
		return false;
	}
	if(Trim(frm.comment.value," ")== "" )
	{
		alert("Please specify your Comment.");
		frm.comment.focus();
		return false;
	}
	return true;
}

function isFeedbackFormOk(frm)
{
	if(Trim(frm.name.value," ")== "" )
	{
		alert("Please specify name.");
		frm.name.focus();
		return false;
	}
	if(Trim(frm.contact_no.value," ")== "" )
	{
		alert("Please Enter Phone Number.");
		frm.contact_no.focus();
		return false;
	}
	if(!IsNumeric2(frm.contact_no.value))
	{
		alert("Please Enter Valid Phone Number.");
		frm.contact_no.focus();
		return false;
	}
	if(!isEmail(frm.email.value))
	{
		frm.email.focus();
		return false;
	}
	if(Trim(frm.comment.value," ")== "" )
	{
		alert("Please specify your Comment.");
		frm.comment.focus();
		return false;
	}
	return true;
}

function isRegisterFormOk(frm)
{
	if(Trim(frm.fname.value," ")== "" )
	{
		alert("Please specify first name.");
		frm.fname.focus();
		return false;
	}
	if(Trim(frm.lname.value," ")== "" )
	{
		alert("Please specify last name.");
		frm.lname.focus();
		return false;
	}
	if(!isEmail(frm.email.value))
	{
		frm.email.focus();
		return false;
	}
	if(Trim(frm.contact_no.value," ")== "" )
	{
		alert("Please Enter Phone Number.");
		frm.contact_no.focus();
		return false;
	}
	if(!IsNumeric2(frm.contact_no.value))
	{
		alert("Please Enter Valid Phone Number.");
		frm.contact_no.focus();
		return false;
	}
	if(Trim(frm.address.value," ")== "" )
	{
		alert("Please specify your address.");
		frm.address.focus();
		return false;
	}
	if(Trim(frm.experience.value," ")== "" )
	{
		alert("Please specify your Professional Experience.");
		frm.experience.focus();
		return false;
	}
	return true;
}


function isExportFormOk(frm)
{
	if(Trim(frm.name.value," ")== "" )
	{
		alert("Please specify Name.");
		frm.name.focus();
		return false;
	}
	if(Trim(frm.bname.value," ")== "" )
	{
		alert("Please specify Business name.");
		frm.bname.focus();
		return false;
	}
	if(!isEmail(frm.email.value))
	{
		frm.email.focus();
		return false;
	}
	if(Trim(frm.contact_no.value," ")== "" )
	{
		alert("Please Enter Phone Number.");
		frm.contact_no.focus();
		return false;
	}
	if(!IsNumeric2(frm.contact_no.value))
	{
		alert("Please Enter Valid Phone Number.");
		frm.contact_no.focus();
		return false;
	}
	if(Trim(frm.address.value," ")== "" )
	{
		alert("Please specify your address.");
		frm.address.focus();
		return false;
	}
	if(Trim(frm.town.value," ")== "" )
	{
		alert("Please specify your Town/Suburb.");
		frm.town.focus();
		return false;
	}
	if(Trim(frm.state.value," ")== "" )
	{
		alert("Please specify your State.");
		frm.state.focus();
		return false;
	}
	if(Trim(frm.zip.value," ")== "" )
	{
		alert("Please specify your Zip.");
		frm.zip.focus();
		return false;
	}
	if(Trim(frm.country.value," ")== "" )
	{
		alert("Please specify your Country.");
		frm.country.focus();
		return false;
	}
	if(Trim(frm.byear.value," ")== "" )
	{
		alert("Please specify numbers of years have you been in business.");
		frm.byear.focus();
		return false;
	}
	if(Trim(frm.details.value," ")== "" )
	{
		alert("Please specify your business details.");
		frm.details.focus();
		return false;
	}
	if(Trim(frm.distribute.value," ")== "" )
	{
		alert("Please specify countries where you distribute to.");
		frm.distribute.focus();
		return false;
	}
	if(Trim(frm.brand.value," ")== "" )
	{
		alert("Please specify Brand Name.");
		frm.brand.focus();
		return false;
	}
	if(Trim(frm.product.value," ")== "" )
	{
		alert("Please specify Product Name.");
		frm.product.focus();
		return false;
	}
	
	return true;
}