var isNav4, isIE4, isNav6 = false;
var range = "";
var styleObj = "";

if (navigator.appVersion.charAt(0) >= 4) {
	if (navigator.appName == "Netscape") {
		if (navigator.appVersion.charAt(0) >= 5) {
			isNav6 = true;
		}
		else {
			isNav4 = true;
		}
	}
	else {
		isIE4 = true;
		range = "all.";
		styleObj = ".style";
	}
}

function getObject(obj) {
	var theObj;
	if (typeof obj == "string") {
		if (isNav6) {
			theObj = document.getElementById(obj).style;
		}
		else {
			theObj = eval("document." + range + obj + styleObj);
		}
	}
	else {
		theObj = obj;
	}
	return theObj;
}

var theOnObj;


function showOne () {
	clearTimeout(delay)
	if (theOnObj) hide(theOnObj);
	var theObj;
	for (var i = 0; i < showOne.arguments.length; i++) {
		theObj = getObject(showOne.arguments[i]);
		theObj.display = "block";
		theObj.visibility = "visible";
		theOnObj = theObj;
	}
}

function show () {
	var theObj;
	for (var i = 0; i < show.arguments.length; i++) {
		theObj = getObject(show.arguments[i]);
		theObj.display = "block";
		theObj.visibility = "visible";
	}
}

function hide () {
	var theObj;
	for (var i = 0; i < hide.arguments.length; i++) {
		theObj = getObject(hide.arguments[i]);
		theObj.display = "none";
		theObj.visibility = "hidden";
	}
}

function delayedHide () {
	var theObj;
	for (var i = 0; i < delayedHide.arguments.length; i++) {
		theObj = getObject(delayedHide.arguments[i]);
		objectsToHide = theObj;
		delay = setTimeout("hide(objectsToHide)",1500)
	}
}

var caption1 = 'caption1'
var caption2 = 'caption2'
var caption3 = 'caption3'
var caption4 = 'caption4'

var tempCaption = ''
var currentCaption = ''

function showCaption (captionId) {
	var captionToShow = captionId
	show(captionToShow)
	/*currentCaption = captionToShow;
	if (captionId == 'caption4') caption4 = currentCaption;
	if (captionId == 'caption1') {
		 var temp = captionId
		 caption1 = caption4
	}
	alert(currentCaption)*/
}

var objectsToHide = null;
var delay = null;


/**** Test Referrer, Supress Pop-ups, and Random Number ****/
// When popParam = ";dcopt=ist;" is passed to a DART ad, pop-ups are allowed.
function testReferrer() {
	var query = window.location.search.substring(1);
	var vars = query.split("&");
	var variable = 'WT.mc_id';
	
	var patterns = new Array();
	patterns[0] = /yahoo/;
	patterns[1] = /google/;
	
	// CHECK and supress pop-up for above patterns
	for (var i=0;i<vars.length;i++) {
	  var pair = vars[i].split("=");
	  if(pair[0] == variable){
	    for(var j = 0; j < patterns.length; j++){
				var result = patterns[j].test(pair[1].toLowerCase());
				if(patterns[j].test(pair[1].toLowerCase()) == true){
					popParam="";
					//alert(patterns[j].test(pair[1].toLowerCase()));
					//alert('Pop-up blocked from ' + patterns[j]);
				}
			}
		}
	}

	// ALLOW only one instance of a pop-up per page
	if (typeof(popParamDisplayed) != "undefined") {
		popParam = "";
	}
	if (popParam == ";dcopt=ist;") {
	   popParamDisplayed = true;
	}
	
	// PASS the same random number to dart for all ads
	if (typeof ord == "undefined") {
			ord=Math.random()*10000000000000000;
	}
}

function get_qs() {
	var qsParm = new Array();
	var query = window.location.search.substring(1);
	var parms = query.split('&');
	for (var i=0; i<parms.length; i++) {
		var pos = parms[i].indexOf('=');
		if (pos > 0 && (parms[i].indexOf("WT.")==0)) {
			var key = parms[i].substring(0,pos);
			var val = parms[i].substring(pos+1);
			qsParm[key] = val;
		}
	}
	return qsParm;
}