function isitblank(obj,msg)
{
		if(obj.value=='')
			{
				alert (msg);
				obj.focus();
				return false;
			}
return true;
}

function validemail(obj)
	{
		if(obj.value==""){}
		else
			{
				if (obj.value.indexOf("@")<2)
				{
				alert("This email address is wrong. Please"
				+" specify the prefix and '@' sign.");
				obj.focus()
				obj.select()
				return false;
				}
				if (obj.value.indexOf(".")==-1) {
					alert("This email address is wrong. "
					+ "It should have a '.' sign.")
					obj.focus();
					obj.select();
					return false;
				}
				if ((obj.value.length-obj.value.indexOf("."))<3)
				{
				alert("This email address is wrong. "
				+" It should include a "
				+".com, .edu, .net, .org, .gov, .mil, .co.in, etc.---)");
				obj.focus()
				obj.select()
				return false;
   				}
			}
 		return true;
	}
function validnumber(obj) {
	if (obj.value=="") {}
	else {
		if (isNaN(obj.value)) {
			alert("::: Please enter a valid Telephone Number :::");
			obj.focus();
			obj.select()
			return false;
		} 
		if (obj.value.length<6) {
			alert("::: Please enter a valid Telephone Number :::");
			obj.focus();
			obj.select()
			return false;
		}
	}
	return true;
}

function validate() {
    if(
    isitblank(document.inquiry.Contact_Person,'::: Please Enter your Contact Person Name :::')&&
	isitblank(document.inquiry.Company,'::: Please Enter your Company Name :::')&&
	isitblank(document.inquiry.Phone,'Please Enter the Telephone Number')&& validnumber(document.inquiry.Phone)&&
	isitblank(document.inquiry.Fax,'Please Enter the Fax Number')&&
    isitblank(document.inquiry.Country,'::: Please Enter your Country Name :::')&&
    isitblank(document.inquiry.EmailID,'::: Please type down your Email Address :::')&&
	validemail(document.inquiry.EmailID)&&
	isitblank(document.inquiry.Inquiry_Type,'Please Select the Inquiry Type')&&
    isitblank(document.inquiry.Products,'Please Select the Product Name \n in which you are interested')&&
    isitblank(document.inquiry.Grade,'Please enter Grade / Quality required.') && validemail(document.inquiry.EmailID)
    	){	return true;}
	else{	return false;	}
}



function validate1() {

	if(document.frm.username.value.length==0){
		alert("::: Please enter your Email ID :::");
		document.frm.username.focus();
		return false;
	}
	if(document.frm.username.value.indexOf('@')==-1){
		alert("::: Error in Email ID :::");
		document.frm.username.focus();
		return false;
	}
	/*if(document.frm.pass.value.length==0){
		alert("::: Please enter your password :::");
		document.frm.pass.focus();
		return false;
	}
	if(document.frm.repass.value.length==0){
		alert("::: Please confirm your password :::");
		document.frm.repass.focus();
		return false;
	}
	if(document.frm.pass.value!=frm.repass.value){
		alert("::: Your passwords do not match. Please enter again :::");
		document.frm.pass.value='';
		document.frm.repass.value='';
		document.frm.pass.focus();
		return false;
	}*/
	
	if(document.frm.contact_person.value.length==0){
		alert("::: Please the contact person's name :::");
		document.frm.contact_person.focus();
		return false;
	}
	
	if(document.frm.address.value==0){
		alert("::: Please specify complete address :::");
		document.frm.address.focus();
		return false;
	}
	if(document.frm.city.value.length==0){
		alert("::: Please specify the city :::");
		document.frm.city.focus();
		return false;
	}
	if(document.frm.state.value.length==0){
		alert("::: Please specify the State/Province :::");
		document.frm.state.focus();
		return false;
	}
	if(document.frm.postcode.value.length==0){
		alert("::: Please enter the postal code :::");
		document.frm.postcode.focus();
		return false;
	}
	if(document.frm.phone1.value.length==0){
		alert("::: Please enter the phone number :::");
		document.frm.phone1.focus();
		return false;
	}
	
}
function validate11() {
    if(isitblank(document.inquiry.Name,'::: Please Enter your Name :::')&&
    isitblank(document.inquiry.Company,'::: Please Enter your Company Name :::')&&
    isitblank(document.inquiry.Country,'::: Please Enter your Country Name :::')&&
    isitblank(document.inquiry.Query,'::: Please tell us your Query / Comments :::')&&
    isitblank(document.inquiry.EmailID,'::: Please type down your Email Address :::')&&
	validemail(document.inquiry.EmailID)
	){	return true;}

	else{	return false;	}
}
function validate12() {
	if(document.changelogin.username.value.length==0){
		alert("::: Please enter your Email ID :::");
		document.changelogin.username.focus();
		return false;
	}
	if(document.changelogin.username.value.indexOf('@')==-1){
		alert("::: Error in Email ID :::");
		document.changelogin.username.focus();
		return false;
	}
	if(document.changelogin.oldpass.value.length==0){
		alert("::: Please enter your Old Password :::");
		document.changelogin.oldpass.focus();
		return false;
	}
	if(document.changelogin.newpass.value.length==0){
		alert("::: Please enter your New Password :::");
		document.changelogin.newpass.focus();
		return false;
	}
	if(document.changelogin.confpass.value.length==0){
		alert("::: Please confirm your Confirm Password :::");
		document.changelogin.confpass.focus();
		return false;
	}
	if(document.changelogin.newpass.value!=changelogin.confpass.value){
		alert("::: Your passwords do not match. Please enter again :::");
		document.changelogin.newpass.value='';
		document.changelogin.confpass.value='';
		document.changelogin.newpass.focus();
		return false;
	}
}
function translator(pattern) {
	var open_in_same_window = 1;
	var my_location = unescape(document.location.toString());
	var new_location ='';
	var new_pattern = '';
	if (my_location.indexOf('translate_c?') != -1) {
		/// From google...
		var indexof_u = my_location.indexOf('u=');
		if (indexof_u == -1) {
			new_location = document.location;
		}
		else {
			var subs = my_location.substring(indexof_u, my_location.length);
			var ss = subs.split('&');
			new_location = ss[0].substring(2, ss[0].length);
		}
	}
	else {
		new_location = document.location;
	}

	indexof_p = pattern.indexOf('|');

	var isen = '';
	if (indexof_p == -1) {
		indexof_p1 = pattern.indexOf('><');
		if (indexof_p1 == -1) {
			new_pattern = pattern;
			if (pattern == 'en') {
				isen = 1;
			}
		}
		else {
			var psplit =pattern.split('><');
			new_pattern = psplit[0]+'|'+psplit[1];
			if (psplit[1] == 'en') {
				isen = 1;
			}
		}
	}
	else {
		var psplit = pattern.split('|');
		new_pattern = psplit[0]+'|'+psplit[1];
		if (psplit[1] == 'en') {
			isen = 1;
		}
	}

	var thisurl = '';
	if (isen == 1) {
		thisurl = new_location;
	}
	else {
		thisurl = 'http://translate.google.com/translate_c?langpair=' + new_pattern + "&u=" + new_location;
	}

	if (open_in_same_window == 1) {
		window.location.href = thisurl;
	}
	else {
		if (CanAnimate ){
			msgWindow=window.open('' ,'subwindow','toolbar=yes,location=yes,directories=yes,status=yes,scrollbars=yes,menubar=yes,resizable=yes,left=0,top=0');
			msgWindow.focus();
			msgWindow.location.href = thisurl;
		}
		else {
			msgWindow=window.open(thisurl,'subwindow','toolbar=yes,location=yes,directories=yes,status=yes,scrollbars=yes,menubar=yes,resizable=yes,left=0,top=0');
		}
	}
}
