// Advansys JavaScript

<!--

function MultiDimensionalArray(iRows,iCols) { 
	var i, j;
	var a = new Array(iRows); 
	for (i=0; i < iRows; i++) { 
		a[i] = new Array(iCols); 
		for (j=0; j < iCols; j++) { 
			a[i][j] = ""; 
		}
	} 
	return(a); 
}

function navigate(s){
	window.location = s;
}


FormObject = new Object();
//[^a-zA-Z]
//[^\@\_\-a-zA-Z0-9\.]
//^[a-z0-9._-]+@[a-z0-9.-]{2,}[.][a-z]{2,3}$
//[^a-zA-Z0-9]
FormObject.checkText = function(d,r,a,ca){
	var re = new RegExp(r,"gi");
	if(re.test(d.value)){
		d.style.backgroundColor='#FFCCCC';
		alert(a);
		var reg = new RegExp(r,"gi")
		d.value = d.value.replace(reg, "");
		d.style.backgroundColor='#FFFFFF';
		if(ca) d.value="";
	}
}

FormObject.checkEmail = function(d,r,a){
	var re = new RegExp(r,"gi");
	if(!re.test(d.value)){
		d.style.backgroundColor='#FFCCCC';
		alert(a);
		var reg = new RegExp(r,"gi")
		d.value = d.value.replace(reg, "");
		d.style.backgroundColor='#FFFFFF';
	}
}


FormObject.isTheSame = function(a, b){
	var m = document.getElementById(b).value;
	if(a.value != m){
		a.style.backgroundColor='#FFCCCC';
		alert('Should be the same as "'+b+'" field.');
		a.value="";
		a.style.backgroundColor='#FFFFFF';
	}
}

FormObject.checkForm = function (b){

	b.FirstName.style.backgroundColor='#FFFFFF';
	b.SecondName.style.backgroundColor='#FFFFFF';
	b.AddressFL.style.backgroundColor='#FFFFFF';
	b.AddressSL.style.backgroundColor='#FFFFFF';
	b.Area.style.backgroundColor='#FFFFFF';
	b.ZipCode.style.backgroundColor='#FFFFFF';
	b.Email.style.backgroundColor='#FFFFFF';
	b.HomePhone.style.backgroundColor='#FFFFFF';
	b.MobPhone.style.backgroundColor='#FFFFFF';
	b.Occupation.style.backgroundColor='#FFFFFF';
	var m = true;
	
	//if(!b.TACAccepted.checked){
//		alert('You haven\'t accepted our terms & conditions please agree to them before you can proceed');
		//return false;
	//}
	if(b.FirstName.value==""){
		b.FirstName.style.backgroundColor='#FFCCCC';
		m = false;
	}
	if(b.SecondName.value==""){
		b.SecondName.style.backgroundColor='#FFCCCC';
		m = false;
	}
	if(b.AddressFL.value==""){
		b.AddressFL.style.backgroundColor='#FFCCCC';
		m = false;
	}
	if(b.AddressSL.value==""){
		b.AddressSL.style.backgroundColor='#FFCCCC';
		m = false;
	}	
	if(b.Area.value==""){
		b.Area.style.backgroundColor='#FFCCCC';
		m = false;
	}	
	if(b.ZipCode.value==""){
		b.ZipCode.style.backgroundColor='#FFCCCC';
		m = false;
	}
	if(b.Email.value==""){
		b.Email.style.backgroundColor='#FFCCCC';
		m = false;
	}
	if(b.HomePhone.value==""){
		b.HomePhone.style.backgroundColor='#FFCCCC';
		m = false;
	}
	if(b.MobPhone.value==""){
		b.MobPhone.style.backgroundColor='#FFCCCC';
		m = false;
	}
	if(b.Occupation.value==""){
		b.Occupation.style.backgroundColor='#FFCCCC';
		m = false;
	}	
	if(!m) alert('All fields are required.');
			
	return m;
}


submitFrm = function(k){
	var f;
	f = document.getElementById("form");
	f.submit();
}


function EmbedFlash(swf){
// Main Flash animation - XHTML 1.0 compliant workaround for IE and Firefox (write as javascript rather then embed HTML))
document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="https://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" id="main01" width="484" height="173">');
document.write('<param name="movie" value="/images/'+swf+'"/>');
document.write('<param name="quality" value="high"/>');
document.write('<param name="base" value="/"/>');
document.write('<param name="loop" value="false"/>');
document.write('<param name="wmode" value="opaque">'); 
document.write('<embed type="application/x-shockwave-flash" src="/images/'+swf+'" width="484" height="173"></embed>');
document.write('</object>');	
}



var req;
var act;
function loadXMLDoc(url) {
	req = false;
    if(window.XMLHttpRequest) {
    	try {
			req = new XMLHttpRequest();
        } catch(e) {
			req = false;
        }
		if(req) {
			req.onreadystatechange = processReqChange;
			req.open("GET", url, true);
			req.send(null);
		}
    } else if(window.ActiveXObject) {
       	try {
        	req = new ActiveXObject("Msxml2.XMLHTTP");
      	} catch(e) {
        	try {
          		req = new ActiveXObject("Microsoft.XMLHTTP");
        	} catch(e) {
          		req = false;
        	}
		}
		if(req) {
			req.onreadystatechange = processReqChange;
			req.open("GET", url, true);
			req.send();
		}
    }
}

function processReqChange() {
    if (req.readyState == 4) {
        if (req.status == 200) {
            if(req.responseText!='' || req.responseText!='undefined') {
            	if(act==1){
            		setCountries(req.responseText);
            	}
			}
        } else {
            alert("There was a problem retrieving the XML data:\n" +
                req.statusText);
        }
    }
}

function setCountries(m) {
	var tstr, ts;
	if(m.indexOf(",")>0) tstr = m.split(",");
	else tstr = m;
	var t = document.getElementById("c2");
	t.options.length = 0;
	t.options[0] = new Option("Any","");
	if(tstr[0]){
		var i;
		for(i=1;i<tstr.length;i++){
			ts = tstr[i].split(":");
			if(ts[0]){
				t.options[i] = new Option(ts[1],ts[0]);
			}
		}
	} else {
		ts = tstr.split(":");
		if(ts[0]){
			t.options[1] = new Option(ts[1],ts[0]);
		}
	}
	t.disabled=false;
}
-->