//created by Rajesh
//Saturday, July 31, 2004

var cList = new Array();
cList[""]		=	"Select Country";
cList["AF"]		=	"Afghanistan";
cList["AL"]		=	"Albania";
cList["DZ"]		=	"Algeria";
cList["AS"]		=	"American Samoa";
cList["AD"]		=	"Andorra";
cList["AO"]		=	"Angola";
cList["AI"]		=	"Anguilla";
cList["AQ"]		=	"Antarctica";
cList["AG"]		=	"Antigua and Barbuda";
cList["AR"]		=	"Argentina";
cList["AM"]		=	"Armenia";
cList["AW"]		=	"Aruba";
cList["AU"]		=	"Australia";
cList["AT"]		=	"Austria";
cList["AZ"]		=	"Azerbaijan";
cList["BS"]		=	"Bahamas";
cList["BH"]		=	"Bahrain";
cList["BK"]		=	"Bangkok";
cList["BD"]		=	"Bangladesh";
cList["BB"]		=	"Barbados";
cList["BY"]		=	"Belarus";
cList["BE"]		=	"Belgium";
cList["BZ"]		=	"Belize";
cList["BJ"]		=	"Benin";
cList["BM"]		=	"Bermuda";
cList["BT"]		=	"Bhutan";
cList["BO"]		=	"Bolivia";
cList["BA"]		=	"Bosnia and Herzegovina";
cList["BW"]		=	"Botswana";
cList["BV"]		=	"Bouvet Island";
cList["BR"]		=	"Brazil";
cList["IO"]		=	"British Indian Ocean Territory";
cList["BN"]		=	"Brunei Darussalam";
cList["BG"]		=	"Bulgaria";
cList["BF"]		=	"Burkina Faso";
cList["BI"]		=	"Burundi";
cList["KH"]		=	"Cambodia";
cList["CM"]		=	"Cameroon";
cList["CA"]		=	"Canada";
cList["CV"]		=	"Cape Verde";
cList["KY"]		=	"Cayman Islands";
cList["CF"]		=	"Central African Republic";
cList["TD"]		=	"Chad";
cList["CL"]		=	"Chile";
cList["CN"]		=	"China";
cList["CX"]		=	"Christmas Island";
cList["CC"]		=	"Cocos (Keeling) Islands";
cList["CO"]		=	"Colombia";
cList["KM"]		=	"Comoros";
cList["CG"]		=	"Congo";
cList["CK"]		=	"Cook Islands";
cList["CR"]		=	"Costa Rica";
cList["CI"]		=	"Cote D'Ivoire (Ivory Coast)";
cList["HR"]		=	"Croatia (Hrvatska)";
cList["CU"]		=	"Cuba";
cList["CY"]		=	"Cyprus";
cList["CZ"]		=	"Czech Republic";
cList["CS"]		=	"Czechoslovakia (former)";
cList["DK"]		=	"Denmark";
cList["DJ"]		=	"Djibouti";
cList["DM"]		=	"Dominica";
cList["DO"]		=	"Dominican Republic";
cList["TP"]		=	"East Timor";
cList["EC"]		=	"Ecuador";
cList["EG"]		=	"Egypt";
cList["SV"]		=	"El Salvador";
cList["GQ"]		=	"Equatorial Guinea";
cList["ER"]		=	"Eritrea";
cList["EE"]		=	"Estonia";
cList["ET"]		=	"Ethiopia";
cList["FK"]		=	"Falkland Islands (Malvinas)";
cList["FO"]		=	"Faroe Islands";
cList["FJ"]		=	"Fiji";
cList["FI"]		=	"Finland";
cList["FR"]		=	"France";
cList["FX"]		=	"France, Metropolitan";
cList["GF"]		=	"French Guiana";
cList["PF"]		=	"French Polynesia";
cList["TF"]		=	"French Southern Territories";
cList["GA"]		=	"Gabon";
cList["GM"]		=	"Gambia";
cList["GE"]		=	"Georgia";
cList["DE"]		=	"Germany";
cList["GH"]		=	"Ghana";
cList["GI"]		=	"Gibraltar";
cList["GB"]		=	"Great Britain (UK)";
cList["GR"]		=	"Greece";
cList["GL"]		=	"Greenland";
cList["GD"]		=	"Grenada";
cList["GP"]		=	"Guadeloupe";
cList["GU"]		=	"Guam";
cList["GT"]		=	"Guatemala";
cList["ZZ"]		=	"Guernsey";
cList["GN"]		=	"Guinea";
cList["GW"]		=	"Guinea-Bissau";
cList["GY"]		=	"Guyana";
cList["HT"]		=	"Haiti";
cList["HM"]		=	"Heard and McDonald Islands";
cList["HN"]		=	"Honduras";
cList["HK"]		=	"Hong Kong";
cList["HU"]		=	"Hungary";
cList["HY"]		=	"Hyvinkaa";
cList["IS"]		=	"Iceland";
cList["IN"]		=	"India";
cList["ID"]		=	"Indonesia";
cList["IR"]		=	"Iran";
cList["IQ"]		=	"Iraq";
cList["IE"]		=	"Ireland";
cList["IL"]		=	"Israel";
cList["IT"]		=	"Italy";
cList["JM"]		=	"Jamaica";
cList["JP"]		=	"Japan";
cList["JO"]		=	"Jordan";
cList["KZ"]		=	"Kazakhstan";
cList["KE"]		=	"Kenya";
cList["KI"]		=	"Kiribati";
cList["KO"]		=	"Korea";
cList["KP"]		=	"Korea (North)";
cList["KR"]		=	"Korea (South)";
cList["KW"]		=	"Kuwait";
cList["KG"]		=	"Kyrgyzstan";
cList["SP"]		=	"Labuan";
cList["LA"]		=	"Laos";
cList["LV"]		=	"Latvia";
cList["LB"]		=	"Lebanon";
cList["LS"]		=	"Lesotho";
cList["LR"]		=	"Liberia";
cList["LY"]		=	"Libya";
cList["LI"]		=	"Liechtenstein";
cList["LT"]		=	"Lithuania";
cList["LU"]		=	"Luxembourg";
cList["MO"]		=	"Macau";
cList["MK"]		=	"Macedonia";
cList["MG"]		=	"Madagascar";
cList["MI"]		=	"Madrid";
cList["MW"]		=	"Malawi";
cList["MY"]		=	"Malaysia";
cList["MV"]		=	"Maldives";
cList["ML"]		=	"Mali";
cList["MT"]		=	"Malta";
cList["MH"]		=	"Marshall Islands";
cList["MQ"]		=	"Martinique";
cList["MR"]		=	"Mauritania";
cList["MU"]		=	"Mauritius";
cList["YT"]		=	"Mayotte";
cList["MX"]		=	"Mexico";
cList["FM"]		=	"Micronesia";
cList["MD"]		=	"Moldova";
cList["MC"]		=	"Monaco";
cList["MN"]		=	"Mongolia";
cList["MS"]		=	"Montserrat";
cList["MA"]		=	"Morocco";
cList["MZ"]		=	"Mozambique";
cList["MM"]		=	"Myanmar";
cList["NA"]		=	"Namibia";
cList["NR"]		=	"Nauru";
cList["NP"]		=	"Nepal";
cList["NL"]		=	"Netherlands";
cList["AN"]		=	"Netherlands Antilles";
cList["NT"]		=	"Neutral Zone";
cList["NC"]		=	"New Caledonia";
cList["NZ"]		=	"New Zealand (Aotearoa)";
cList["NI"]		=	"Nicaragua";
cList["NE"]		=	"Niger";
cList["NG"]		=	"Nigeria";
cList["NU"]		=	"Niue";
cList["NF"]		=	"Norfolk Island";
cList["MP"]		=	"Northern Mariana Islands";
cList["NO"]		=	"Norway";
cList["OM"]		=	"Oman";
cList["PK"]		=	"Pakistan";
cList["PW"]		=	"Palau";
cList["YY"]		=	"Palestine";
cList["PA"]		=	"Panama";
cList["PG"]		=	"Papua New Guinea";
cList["PY"]		=	"Paraguay";
cList["PS"]		=	"Paris";
cList["PE"]		=	"Peru";
cList["PH"]		=	"Philippines";
cList["PN"]		=	"Pitcairn";
cList["PL"]		=	"Poland";
cList["PT"]		=	"Portugal";
cList["PR"]		=	"Puerto Rico";
cList["QA"]		=	"Qatar";
cList["RE"]		=	"Reunion";
cList["RO"]		=	"Romania";
cList["RU"]		=	"Russian Federation";
cList["RW"]		=	"Rwanda";
cList["GS"]		=	"S. Georgia and S. Sandwich Isls.";
cList["LC"]		=	"Saint Lucia";
cList["WS"]		=	"Samoa";
cList["SM"]		=	"San Marino";
cList["ST"]		=	"Sao Tome and Principe";
cList["SA"]		=	"Saudi Arabia";
cList["XW"]		=	"Scotland";
cList["SN"]		=	"Senegal";
cList["ME"]		=	"Serbia";
cList["SC"]		=	"Seychelles";
cList["SL"]		=	"Sierra Leone";
cList["SG"]		=	"Singapore";
cList["SQ"]		=	"Slovakia";
cList["SK"]		=	"Slovak Republic";
cList["SI"]		=	"Slovenia";
cList["SB"]		=	"Solomon Islands";
cList["SO"]		=	"Somalia";
cList["ZA"]		=	"South Africa";
cList["ES"]		=	"Spain";
cList["LK"]		=	"Sri Lanka";
cList["KN"]		=	"St Kitts and Nevis";
cList["VC"]		=	"St Vincent and the Grenadines";
cList["SH"]		=	"St. Helena";
cList["PM"]		=	"St. Pierre and Miquelon";
cList["SD"]		=	"Sudan";
cList["SR"]		=	"Suriname";
cList["SJ"]		=	"Svalbard and Jan Mayen Islands";
cList["SZ"]		=	"Swaziland";
cList["SE"]		=	"Sweden";
cList["CH"]		=	"Switzerland";
cList["SY"]		=	"Syria";
cList["TW"]		=	"Taiwan";
cList["TJ"]		=	"Tajikistan";
cList["TZ"]		=	"Tanzania";
cList["TH"]		=	"Thailand";
cList["TG"]		=	"Togo";
cList["TK"]		=	"Tokelau";
cList["TO"]		=	"Tonga";
cList["TT"]		=	"Trinidad and Tobago";
cList["TN"]		=	"Tunisia";
cList["TR"]		=	"Turkey";
cList["TM"]		=	"Turkmenistan";
cList["TC"]		=	"Turks and Caicos Islands";
cList["TI"]		=	"Turks & Caicos Islands";
cList["TV"]		=	"Tuvalu";
cList["UG"]		=	"Uganda";
cList["UA"]		=	"Ukraine";
cList["AE"]		=	"United Arab Emirates";
cList["UK"]		=	"United Kingdom";
cList["US"]		=	"United States";
cList["UY"]		=	"Uruguay";
cList["UM"]		=	"US Minor Outlying Islands";
cList["SU"]		=	"USSR (former)";
cList["UZ"]		=	"Uzbekistan";
cList["VU"]		=	"Vanuatu";
cList["VA"]		=	"Vatican City State (Holy See)";
cList["VE"]		=	"Venezuela";
cList["VN"]		=	"Viet Nam";
cList["VG"]		=	"Virgin Islands (British)";
cList["VI"]		=	"Virgin Islands (U.S.)";
cList["WF"]		=	"Wallis and Futuna Islands";
cList["EH"]		=	"Western Sahara";
cList["YE"]		=	"Yemen";
cList["YU"]		=	"Yugoslavia";
cList["ZR"]		=	"Zaire";
cList["ZB"]		=	"Zanzibar";
cList["ZM"]		=	"Zambia";
cList["ZW"]		=	"Zimbabwe";

function removeFilter(obj, sel, info) {
	removeAll(obj);
	if (info)
	{
		var newitem = document.createElement("OPTION");
		newitem.text = "select...";
		newitem.value = "";
		obj.add(newitem);

	}
	for(elem in cList)
	{
		var newitem = document.createElement("OPTION");
		newitem.text = cList[elem];
		newitem.value = elem;
		obj.add(newitem);
	}
	if (sel<obj.options.length)
	{
		obj.options.selectedIndex = sel;
	}
}

function setFilter(obj, index, def) {
	//alert(obj);
	removeAll(obj);
	if (index == "")
	{
		obj.disabled = "disabled";
		return;
	}
	var cnt = 0, i=0;
	for(elem in cList)
	{
		if (cList[elem].substr(0,1)==index) {
			var newitem = document.createElement("OPTION");
			newitem.text = cList[elem];
			newitem.value = elem;
			if (def !=null && elem == def) { cnt=i;}
			//alert(newitem);
			try
    {
    obj.add(newitem); // standards compliant
    }
  catch(ex)
    {
   obj.add(newitem,null);; // IE only
    }

			
		}
	}
	if (obj.options.length>0) {
		obj.options[cnt].selected = true;
		obj.disabled = "";
		enable();
		obj.focus();
	} else {
		obj.disabled = "disabled";
	}
}
function setcountry(id,sel) {
  // alert(id);
   obj=document.getElementById(id);
   //alert(obj);
	var cnt = 0, i=0;
	for(elem in cList)
	{
		
			var newitem = document.createElement("OPTION");
			newitem.text = cList[elem];
			newitem.value = elem;
			
try
    {
    obj.add(newitem); // standards compliant
    }
  catch(ex)
    {
   obj.add(newitem,null);; // IE only
    }
	
			//obj.add(newitem,null);
			
		
	}
	
}

function removeAll(objname) {
	//alert(objname.options.length);
	i=0;
	objname.options.length=0;
	
} function onlyAlpha(src)
{
	var regex = /^[a-z A-Z]+$/;
    return regex.test(src);
}

function onlyInteger(src)
{
	var regex = /^[0-9]+$/;
    return regex.test(src);
}
function onlyFloat(src)
{
	var regex = /^[0-9.]+$/;
    return regex.test(src);
}
function onlyNumber(src)
{
	var regex = /^[0-9.]+$/;
    return regex.test(src);
}



//validate email address
function checkEmailAddress(src)
{
	var regex = /^[a-zA-Z0-9._-]+@([a-zA-Z0-9.-]+\.)+[a-zA-Z0-9.-]{2,5}$/;
    return regex.test(src);
}
function checkWEBSITE(src)
{
	var regex = /^[a-zA-Z0-9._-]+([a-zA-Z0-9.-]+\.)+[a-zA-Z0-9.-]{2,5}$/;
    return regex.test(src);
}

function validate_frm()
{ 
	//alert('dd');
	
	conum=document.offline.conum;
	coname=document.offline.coname;
	bldg=document.offline.bldg;
	street=document.offline.street;
	city=document.offline.city;
	county=document.offline.county;
	zip=document.offline.zip;
	tele=document.offline.tele;
	ctry=document.offline.ctry;
	ref=document.offline.ref;
	attn=document.offline.attn;
	credit=document.offline.credit;
	amount=document.offline.amount;
	bankers=document.offline.bankers;
	remarks=document.offline.remarks;
	servtype=document.offline.servtype;
	fromcompany=document.offline.fromcompany;
	concerned=document.offline.concerned;
	contactemail=document.offline.contactemail;
	contactphone=document.offline.contactphone;
	country_name=document.offline.country_name;

selText = ctry.options[ctry.selectedIndex].text;

     if(coname.value=='')
		{
			alert('Please Enter Company name');
			coname.focus();
			coname.select();
			return false;
		}
     if(bldg.value=='')
		{
			alert('Please Enter Building');
			bldg.focus();
			bldg.select();
			return false;
		}
	
     if(city.value=='')
		{
			alert('Please Enter City ');
			city.focus();
			city.select();
			return false;
		}
	
	if(zip.value!='')
	{		
     
		if(!onlyInteger(zip.value))
		{
			alert('Invalid Zip Code');
			zip.focus();
			zip.select();
			return false;
		}
	}
	if(tele.value=='')
	{		
     		alert('Enter Telephone No');
			tele.focus();
			tele.select();
			return false;
	}
	if(!onlyInteger(tele.value))
	{		
     		alert('Invalid Telephone No');
			tele.focus();
			tele.select();
			return false;
	}
	
		if(ctry.selectedIndex==0)
		{
			alert('Please Select Country');
			ctry.focus();
			
			return false;
		}
		if(fromcompany.value=='')
		{
			alert('Please Enter  Company Name');
			fromcompany.focus();
			fromcompany.select();
			return false;
		}
		if(concerned.value=='')
		{
			alert('Please Enter  Concerned Person  Name');
			concerned.focus();
			concerned.select();
			return false;
		}
		if(contactemail.value=='')
		{
			alert('Please Enter  Email');
			contactemail.focus();
			contactemail.select();
			return false;
		}
		if(!checkEmailAddress(contactemail.value))
		{
			alert('Invalid Email Address.');
			contactemail.focus();
			contactemail.select();
			return false;
		}
		if(contactphone.value=='')
	{		alert('Please Enter Telephone No');
			contactphone.focus();
			contactphone.select();
			return false;
	}
     
	 document.offline.country_name.value=selText;
}
function onlyInteger(src)
{
	var regex = /^[0-9]+$/;
    return regex.test(src);
}