﻿function setCategory(el) {

var categories = new Object;
	
categories["Ask For Help"] = new Array("Installation","Phone issues","Connection Issues","Compatibility","How to...","Website","Other");
categories["Report A Bug"] = new Array("Installation","Phone issues","Connection Issues","Compatibility","Clips","Buddies","Other");
categories["Feature Request"] = new Array("Other"); 
categories["Suggestion"] = new Array("Other"); 

var target = $('00N20000000vHHQ');

if (categories[$F(el)])
 {
 cleanSelect(target);
 categories[$F(el)].each(function(subcategory) {
 makeOption(target,subcategory,subcategory)
 });
// target.disabled=false;
 }

}

function setDeviceType(el) {

var categories = new Object;

categories["Nokia"] = new Array("2310","2600","2610","2626","3100","3120","3220","3250","3310","3410","3510","5200","5300","5500","5700","6020","6021","6080","6085","6086","6100","6101","6110","6111","6120","6126","6131","6133","6136","6151","6230","6233","6270","6280","6290","6630","6680","7360","7373","7390","2366i","3510i","6230i","E50","E60","E61","E61i","E62","E65","E70","E90","N70","N73","N75","N76","N80","N81","N82","N91","N93","N93i","N95","N95 8GB","Other"); 
categories["Sony Ericsson"] = new Array("K300i","K530i","K550i","K600i","K608i","K610i","K660i","K750i","K770i","K790a","K800i","K810i","K850i","M600i","P1i","P990","S500i","T230","T610","T650i","V600i","V800","W300i","W580i","W610i","W660i","W710i","W850i","W880i","W890i","W910i","W960i","Z610i","Z710i","Z750i","Other");
categories["Motorola"] = new Array("i885","ic502","KRZR K1","KRZR K1m","L6 Black","Q","RAZR","RAZR MAXX VE","RAZR Pink","RAZR V3i","RIZR Z3","RIZR Z3 Rose","SLVR","SLVR L7","V197","V220","V3","V360","V365","V3c","V3m","V3t","V3x","V3xx","V500","V547","V6","W370","Other");
categories["HTC"] = new Array("Dash","SDA","S710 (Vox)","SPV C600","SPV E650","SPV M3100","SPV M700","XV6700","Other");

categories["Samsung"] = new Array("SCH-340","SCH-A610","SCH-i730","SCH-U340","SCH-U520","SCH-U540","SCH-U620","SCH-U740","SGH-A707","SGH-A970","SGH-C417","SGH-C417","SGH-d406","SGH-D500","SGH-D500E","SGH-D600","SGH-D900","SGH-E330","SGH-E350","SGH-E360e","SGH-E370","SGH-E630","SGH-E730","SGH-E900","SGH-E950","SGH-i550","SGH-i600","SGH-i607","SGH-i830","SGH-N330","SGH-S400i","SGH-T209","SGH-T219","SGH-T329","SGH-T509","SGH-T519","SGH-T619","SGH-T629","SGH-T809","SGH-U540","SGH-U600","SGH-X450","SGH-X475","SGH-X480","SGH-X495","SGH-X640","SGH-X660","SGH-X660v","SGH-Z140","SGH-Z500","SPH-M620","Other");
categories["Sanyo"] = new Array("8200","8400","Katana 6600","M1","MM 7500","MM 8300","MM 9000","RL 4930","VI 2300","Other");
categories["Palm Treo"] = new Array("650","680","700p","700w","700wx (WM)","Other");
categories["LG"] = new Array("8830","AX275 Silver","AX355","AX390","AX5000","AX8600","C1100","C3310","CU400","F2400","KG220","KG800","L342i","L343i","LX150","VX8600","VX8700","VX9400","VX9900 enV","Other");
categories["BlackBerry"] = new Array("7250","8800","7130c","7130e","8700c","8703e","MDA","Pearl","Other");
categories["Orange SPV"] = new Array("C100","C600","Other");
categories["Other"] = new Array("Other");

var target = $('00N20000000vHCM');

if (categories[$F(el)])
 {
 cleanSelect(target);
 makeOption(target,"","--None--")
 categories[$F(el)].each(function(model) {
 makeOption(target,model,model)
 });
 target.disabled=false;
 }
else
 {
 cleanSelect(target);
 makeOption(target,"Coming Soon","Coming Soon")
 target.value="Coming Soon";
 target.disabled=true;
 }

//	Report a Bug	Feature Request

//alert($F(el));

//alert(categories["Ask For Help"][1]);

}

function cleanSelect(target)
 {
 while (target.firstChild)
 target.removeChild(target.firstChild);
 }

function makeOption(target,value,title)
 {
 t=document.createElement("option");
 t.appendChild(document.createTextNode(title));
 t.setAttribute("value",value);
 target.appendChild(t);
 }

function setCountryCode(el) {

//alert(country_codes[$F(el)]);

//if (country_codes[$F(el)])
// $('00N20000000vKO5').value=country_codes[$F(el)];

if (country_codes[el.value])
 document.getElementById('country_code').value=country_codes[el.value];

}

var country_codes = new Object;
country_codes['Afghanistan']= 93 ;
country_codes['Albania']= 355 ;
country_codes['Algeria']= 213 ;
country_codes['AmericanSamoa']= 684 ;
country_codes['Andorra']= 376 ;
country_codes['Angola']= 244 ;
country_codes['Anguilla']= 809 ;
country_codes['Antigua']= 268 ;
country_codes['Argentina']= 54 ;
country_codes['Armenia']= 374 ;
country_codes['Aruba']= 297 ;
country_codes['AscensionIsland']= 247 ;
country_codes['Australia']= 61 ;
country_codes['AustralianExternalTerritories']= 672 ;
country_codes['Austria']= 43 ;
country_codes['Azerbaijan']= 994 ;
country_codes['Bahamas']= 242 ;
country_codes['Barbados']= 246 ;
country_codes['Bahrain']= 973 ;
country_codes['Bangladesh']= 880 ;
country_codes['Belarus']= 375 ;
country_codes['Belgium']= 32 ;
country_codes['Belize']= 501 ;
country_codes['Benin']= 229 ;
country_codes['Bermuda']= 809 ;
country_codes['Bhutan']= 975 ;
country_codes['BritishVirginIslands']= 284 ;
country_codes['Bolivia']= 591 ;
country_codes['BosniaandHercegovina']= 387 ;
country_codes['Botswana']= 267 ;
country_codes['Brazil']= 55 ;
country_codes['BritishV.I.']= 284 ;
country_codes['BruneiDarussalm']= 673 ;
country_codes['Bulgaria']= 359 ;
country_codes['BurkinaFaso']= 226 ;
country_codes['Burundi']= 257 ;
country_codes['Cambodia']= 855 ;
country_codes['Cameroon']= 237 ;
country_codes['Canada']= 1 ;
country_codes['CaprVerdeIslands']= 238 ;
country_codes['CaribbeanNations']= 1 ;
country_codes['CaymanIslands']= 345 ;
country_codes['CapeVerdi']= 238 ;
country_codes['CentralAfricanRepublic']= 236 ;
country_codes['Chad']= 235 ;
country_codes['Chile']= 56 ;
country_codes['China(People\'sRepublic)']= 86 ;
country_codes['China-Taiwan']= 886 ;
country_codes['Colombia']= 57 ;
country_codes['ComorosandMayotte']= 269 ;
country_codes['Congo']= 242 ;
country_codes['CookIslands']= 682 ;
country_codes['CostaRica']= 506 ;
country_codes['Croatia']= 385 ;
country_codes['Cuba']= 53 ;
country_codes['Cyprus']= 357 ;
country_codes['CzechRepublic']= 420 ;
country_codes['Denmark']= 45 ;
country_codes['DiegoGarcia']= 246 ;
country_codes['Dominca']= 767 ;
country_codes['DominicanRepublic']= 809 ;
country_codes['Djibouti']= 253 ;
country_codes['Ecuador']= 593 ;
country_codes['Egypt']= 20 ;
country_codes['ElSalvador']= 503 ;
country_codes['EquatorialGuinea']= 240 ;
country_codes['Eritrea']= 291 ;
country_codes['Estonia']= 372 ;
country_codes['Ethiopia']= 251 ;
country_codes['FalklandIslands']= 500 ;
country_codes['Faroe(Faeroe)Islands(Denmark)']= 298 ;
country_codes['Fiji']= 679 ;
country_codes['Finland']= 358 ;
country_codes['France']= 33 ;
country_codes['FrenchAntilles']= 596 ;
country_codes['FrenchGuiana']= 594 ;
country_codes['Gabon(GaboneseRepublic)']= 241 ;
country_codes['Gambia']= 220 ;
country_codes['Georgia']= 995 ;
country_codes['Germany']= 49 ;
country_codes['Ghana']= 233 ;
country_codes['Gibraltar']= 350 ;
country_codes['Greece']= 30 ;
country_codes['Greenland']= 299 ;
country_codes['Grenada/Carricou']= 473 ;
country_codes['Guam']= 671 ;
country_codes['Guatemala']= 502 ;
country_codes['Guinea']= 224 ;
country_codes['Guinea-Bissau']= 245 ;
country_codes['Guyana']= 592 ;
country_codes['Haiti']= 509 ;
country_codes['Honduras']= 504 ;
country_codes['HongKong']= 852 ;
country_codes['Hungary']= 36 ;
country_codes['Iceland']= 354 ;
country_codes['India']= 91 ;
country_codes['Indonesia']= 62 ;
country_codes['Iran']= 98 ;
country_codes['Iraq']= 964 ;
country_codes['Ireland(IrishRepublic;Eire)']= 353 ;
country_codes['Israel']= 972 ;
country_codes['Italy']= 39 ;
country_codes['IvoryCoast(LaCoted\'Ivoire)']= 225 ;
country_codes['Jamaica']= 876 ;
country_codes['Japan']= 81 ;
country_codes['Jordan']= 962 ;
country_codes['Kazakhstan']= 7 ;
country_codes['Kenya']= 254 ;
country_codes['KhmerRepublic(Cambodia/Kampuchea)']= 855 ;
country_codes['KiribatiRepublic(GilbertIslands)']= 686 ;
country_codes['KoreaRepublicof(SouthKorea)']= 82 ;
country_codes['KoreaPeople\'sRepublicof(NorthKorea)']= 850 ;
country_codes['Kuwait']= 965 ;
country_codes['KyrgyzRepublic']= 996 ;
country_codes['Latvia']= 371 ;
country_codes['Laos']= 856 ;
country_codes['Lebanon']= 961 ;
country_codes['Lesotho']= 266 ;
country_codes['Liberia']= 231 ;
country_codes['Lithuania']= 370 ;
country_codes['Libya']= 218 ;
country_codes['Liechtenstein']= 423 ;
country_codes['Luxembourg']= 352 ;
country_codes['Macao']= 853 ;
country_codes['Macedonia']= 389 ;
country_codes['Madagascar']= 261 ;
country_codes['Malawi']= 265 ;
country_codes['Malaysia']= 60 ;
country_codes['Maldives']= 960 ;
country_codes['Mali']= 223 ;
country_codes['Malta']= 356 ;
country_codes['MarshallIslands']= 692 ;
country_codes['Martinique(FrenchAntilles)']= 596 ;
country_codes['Mauritania']= 222 ;
country_codes['Mauritius']= 230 ;
country_codes['Mayolte']= 269 ;
country_codes['Mexico']= 52 ;
country_codes['Micronesia(F.S.ofPolynesia)']= 691 ;
country_codes['Moldova']= 373 ;
country_codes['Monaco']= 33 ;
country_codes['Mongolia']= 976 ;
country_codes['Montserrat']= 473 ;
country_codes['Morocco']= 212 ;
country_codes['Mozambique']= 258 ;
country_codes['Myanmar(formerBurma)']= 95 ;
country_codes['Namibia(formerSouth-WestAfrica)']= 264 ;
country_codes['Nauru']= 674 ;
country_codes['Nepal']= 977 ;
country_codes['Netherlands']= 31 ;
country_codes['NetherlandsAntilles']= 599 ;
country_codes['Nevis']= 869 ;
country_codes['NewCaledonia']= 687 ;
country_codes['NewZealand']= 64 ;
country_codes['Nicaragua']= 505 ;
country_codes['Niger']= 227 ;
country_codes['Nigeria']= 234 ;
country_codes['Niue']= 683 ;
country_codes['NorthKorea']= 850 ;
country_codes['NorthMarianaIslands(Saipan)']= 1670 ;
country_codes['Norway']= 47 ;
country_codes['Oman']= 968 ;
country_codes['Pakistan']= 92 ;
country_codes['Palau']= 680 ;
country_codes['Panama']= 507 ;
country_codes['PapuaNewGuinea']= 675 ;
country_codes['Paraguay']= 595 ;
country_codes['Peru']= 51 ;
country_codes['Philippines']= 63 ;
country_codes['Poland']= 48 ;
country_codes['Portugal(includesAzores)']= 351 ;
country_codes['PuertoRico']= 1787 ;
country_codes['Qatar']= 974 ;
country_codes['Reunion(France)']= 262 ;
country_codes['Romania']= 40 ;
country_codes['Russia']= 7 ;
country_codes['Rwanda(RwandeseRepublic)']= 250 ;
country_codes['Saipan']= 670 ;
country_codes['SanMarino']= 378 ;
country_codes['SaoTomeandPrincipe']= 239 ;
country_codes['SaudiArabia']= 966 ;
country_codes['Senegal']= 221 ;
country_codes['SerbiaandMontenegro']= 381 ;
country_codes['Seychelles']= 248 ;
country_codes['SierraLeone']= 232 ;
country_codes['Singapore']= 65 ;
country_codes['Slovakia']= 421 ;
country_codes['Slovenia']= 386 ;
country_codes['SolomonIslands']= 677 ;
country_codes['Somalia']= 252 ;
country_codes['SouthAfrica']= 27 ;
country_codes['Spain']= 34 ;
country_codes['SriLanka']= 94 ;
country_codes['St.Helena']= 290 ;
country_codes['St.Kitts/Nevis']= 869 ;
country_codes['St.Pierre&(et)Miquelon(France)']= 508 ;
country_codes['Sudan']= 249 ;
country_codes['Suriname']= 597 ;
country_codes['Swaziland']= 268 ;
country_codes['Sweden']= 46 ;
country_codes['Switzerland']= 41 ;
country_codes['SyrianArabRepublic(Syria)']= 963 ;
country_codes['Tahiti(FrenchPolynesia)']= 689 ;
country_codes['Taiwan']= 886 ;
country_codes['Tajikistan']= 7 ;
country_codes['Tanzania(includesZanzibar)']= 255 ;
country_codes['Thailand']= 66 ;
country_codes['Togo(TogoleseRepublic)']= 228 ;
country_codes['Tokelau']= 690 ;
country_codes['Tonga']= 676 ;
country_codes['TrinidadandTobago']= 1868 ;
country_codes['Tunisia']= 216 ;
country_codes['Turkey']= 90 ;
country_codes['Turkmenistan']= 993 ;
country_codes['Tuvalu(ElliceIslands)']= 688 ;
country_codes['Uganda']= 256 ;
country_codes['Ukraine']= 380 ;
country_codes['UnitedArabEmirates']= 971 ;
country_codes['UnitedKingdom']= 44 ;
country_codes['Uruguay']= 598 ;
country_codes['USA']= 1 ;
country_codes['Uzbekistan']= 7 ;
country_codes['Vanuatu(NewHebrides)']= 678 ;
country_codes['VaticanCity']= 39 ;
country_codes['Venezuela']= 58 ;
country_codes['VietNam']= 84 ;
country_codes['VirginIslands']= 1340 ;
country_codes['WallisandFutuna']= 681 ;
country_codes['WesternSamoa']= 685 ;
country_codes['Yemen(People\'sDemocraticRepublicof)']= 381 ;
country_codes['YemenArabRepublic(NorthYemen)']= 967 ;
country_codes['Yugoslavia(discontinued)']= 381 ;
country_codes['Zaire']= 243 ;
country_codes['Zambia']= 260 ;
country_codes['Zimbabwe']= 263 ;

function setCountry(el) {

//$('00N20000000vFJe').disabled=(el.value!="USA");

if (el.value!="USA" && el.value!="Canada")
{
 document.getElementById('state').value="";
}
 
document.getElementById('state').disabled=(el.value!="USA" && el.value!="Canada");

}



function Validate (form) 
{

var valid=true;

var messages="";
var wrong_fields=new Array();

// Clear all the "Required" error messages
requiredSpans=document.getElementsByClassName("required")
for (var e = 0; e < requiredSpans.length; e++)
 requiredSpans[e].innerHTML="";

for (var e = 0; e < form.elements.length; e++)
 {

 if (form.elements[e].getAttribute('valid') && form.elements[e].value!="" && form.elements[e].value!=-1)
  {
  pt=new RegExp(form.elements[e].getAttribute('valid'),"gi");
  if (!pt.test(form.elements[e].value)) 
   {
   valid=false;
   messages+='Field \"'+form.elements[e].getAttribute('description')+'\" contains wrong character(s) \n';
   }
  }

 if (form.elements[e].getAttribute('required')==1)
  if (form.elements[e].value=="" || form.elements[e].value=="0" || form.elements[e].value==-1)
   {
   valid=false;
   if (form.elements[e].name.indexOf('_box')!=-1)
    messages+='Please choose \"'+form.elements[e].getAttribute('description')+'\" at least one box \n';
   else
    {
    messages+=form.elements[e].getAttribute('description')+'\n';
    wrong_fields[wrong_fields.length]=form.elements[e].id;
    }
   }

 }
 
 

if (messages!="") 
 {
 alert("Please fill in all the Required fields");
 for (var e = 0; e < wrong_fields.length; e++)
  {
  if ($(wrong_fields[e]+"_msg"))
   $(wrong_fields[e]+"_msg").innerHTML="Required";
  }
 }

 //if all field are ok then check regEXP mail
 if(valid){
	valid=validateEmail();
 }
return valid;

}



function validateEmail() {
   var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
   var address = document.forms['frm'].elements['email'].value;
   if(reg.test(address) == false) {
	  document.getElementById('email_msg').innerText='Invalid';
      alert('Invalid Email Address');
      return false;
   }
}

