
ns4 = (document.layers) ? true:false
ie4 = (document.all) ? true:false
dom = (document.getElementById) ? true:false



// popup a window to the winner photos
function winnersPicturesNoScroll(url) {
	window.open(url,"winner_window","left=0,top=0,width=394,height=317,scrollbars=no,resizable=no");
}



// popup a window to display terms and conditions
function showTerms() {
	popupWindow("../home/terms.html", 400, 400);
}

// popup a window to display PROMO terms and conditions
function showPromoTerms() {
	popupWindow("../home/promoterms.html", 400, 400);
}

// popup a window to display Rhianna Biog
function showRhianna() {
	popupWindow("../casting/rhianna.html", 700, 500);
}



// popup a window to display PREREG terms and conditions
function showPreRegTerms() {
	popupWindow("../home/preregterms.html", 400, 400);
}

// popup a window to display privacy policy
function showPrivacy() {
	popupWindow("../home/terms.html#privacy", 400, 400);
}

// popup a window to display terms and conditions
function showPrintout() {
	popupWindow("../casting/printout.html", 500, 500);
}

// popup a window to show video
function showVideo(number) {
	var popupLocation = "../voting/video.html?id=" + number;
	var popupWidth = 302;
	var popupHeight = 335;	

	var heightspeed = 15; 	// vertical speed
	var widthspeed 	= 15;  	// horizontal speed
	var leftdist 	= (screen.width - popupWidth) / 2;    	// distance to left edge of window
	var topdist 	= (screen.height - popupHeight) / 2;   	// distance to top edge of window
	if (document.all) {
		var popup = window.open("","","left=" + leftdist + ",top=" + topdist + ",width=4,height=4,scrollbars=no,resizable=no,status=no");
		for (sizeheight = 1; sizeheight < popupHeight; sizeheight += heightspeed) {
			popup.resizeTo("1", sizeheight);
		}
		for (sizewidth = 1; sizewidth < popupWidth; sizewidth += widthspeed) {
			popup.resizeTo(sizewidth, sizeheight);
		}	
		popup.resizeTo(popupWidth, popupHeight);
		popup.location = popupLocation;
	} else {
		var popup = window.open(popupLocation,"","left=" + leftdist + ",top=" + topdist + ",width=" + popupWidth + ",height=" + popupHeight + ",scrollbars=yes,resizable=yes");
	}
	
}

// get query string parameters from location string
function getArgs() {
	var args = new Object();
	var query = location.search.substring(1); 	// get query string
	var pairs = query.split("&");								// break at comma
	for (var i=0; i<pairs.length; i++) {
		var pos = pairs[i].indexOf('=');		// look for name='value'
		if (pos != -1) {
			var argname = pairs[i].substring(0,pos);	// extract name
			var argvalue = pairs[i].substring(pos+1);	// extract value
			args[argname] = unescape(argvalue);	// store as property of args
		}
	}
	return args;	// return the object
}


// hide the choose countries table
function hideCountries() {
	hide("chooseCountry");
	// document.all["chooseCountry"].style.visibility = "hidden";	
}

// show the choose countries table
function showCountries() {
	show("chooseCountry");
}

function show(i) {
	if (dom){
		document.getElementById(i).style.visibility = "visible";
	} else if (ie4){
		document.all[i].style.visibility = "visible";
	} else if (ns4){
		document[i].visibility = "visible";
	}
}

function hide(i) {
	if (dom){
		document.getElementById(i).style.visibility = "hidden";
	} else if (ie4){
		document.all[i].style.visibility = "hidden";
	} else if (ns4){
		document[i].visibility = "hide";
	}
}


// generic window popup function... resizes as it opens
function popupWindow(popupLocation, popupWidth, popupHeight) {
	var heightspeed = 15; 	// vertical speed
	var widthspeed 	= 15;  	// horizontal speed
	var leftdist 	= (screen.width - popupWidth) / 2;    	// distance to left edge of window
	var topdist 	= (screen.height - popupHeight) / 2;   	// distance to top edge of window
	if (document.all) {
		var popup = window.open("","","left=" + leftdist + ",top=" + topdist + ",width=4,height=4,scrollbars=yes,resizable=yes,status=no");
		for (sizeheight = 1; sizeheight < popupHeight; sizeheight += heightspeed) {
			popup.resizeTo("1", sizeheight);
		}
		for (sizewidth = 1; sizewidth < popupWidth; sizewidth += widthspeed) {
			popup.resizeTo(sizewidth, sizeheight);
		}	
		popup.resizeTo(popupWidth, popupHeight);
		popup.location = popupLocation;
	} else {
		var popup = window.open(popupLocation,"","left=" + leftdist + ",top=" + topdist + ",width=" + popupWidth + ",height=" + popupHeight + ",scrollbars=yes,resizable=yes");
	}
}


