// JavaScript Document

/* ----- query string array ----- */

var request = new Array(); // in case we need an associative array to handle query string.

function makeRequestArray() { //makes an associative array request["fname"] etc ...

	//populate the empty array request() with name / value pairs from the query string.
	var query = unescape(document.location.search);
	query = query.substring(1,query.length);
	query = query.replace(/\+/g," ");

	var arrQ = query.split("&");
	for(i=0;i<arrQ.length; i++) {
		arrQ2 = arrQ[i].split('=');
		request[arrQ2[0]] = arrQ2[1];
	}
} 

makeRequestArray();

/* ----- Multi-Browser DOM operator ----- */

var isDHTML = 0;
var isLayers = 0;
var isAll = 0;
var isID = 0;

if (document.getElementById) {isID = 1; isDHTML = 1;}
else {
   browserVersion = parseInt(navigator.appVersion);
   if ((navigator.appName.indexOf('Netscape') != -1) && (browserVersion == 4)) {isLayers = 1; isDHTML = 1;}
   else {
     if (document.all) {isAll = 1; isDHTML = 1;}
}}

function findDOM(objectID,withStyle) {
	if (withStyle == 1) {
		if (isID) { return (document.getElementById(objectID).style) ; }
		else { 
			if (isAll) { return (document.all[objectID].style); }
		else {
			if (isLayers) { return (document.layers[objectID]); }
		};}
	}
	else {
		if (isID) { return (document.getElementById(objectID)) ; }
		else { 
			if (isAll) { return (document.all[objectID]); }
		else {
			if (isLayers) { return (document.layers[objectID]); }
		};}
	}
}

//--------------------- Cookie Management ----------------------------//

function createCookie(name,value,days) {
	if (days) {
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
}

function readCookie(name) {
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}

function eraseCookie(name) {
	createCookie(name,"",-1);
}


/* ------------ Create Cookie from Google SEM Keyword ----------------

function googleSEMset() {
	if (typeof request["semcp"] != "undefined") {
		createCookie("contactAdviserGoogleCamp",request["semcp"],7);
		createCookie("contactAdviserGoogleAdword",request["semad"],7);
	}
}

function googleSEMget(x) {
	switch (x) {
		case "semcp" : return readCookie("contactAdviserGoogleCamp"); break;
		case "semad" : return readCookie("contactAdviserGoogleAdword"); break;
	}
}

----- */