function SetBookmark(){
	URL="http://www.variety.com/ftp_variety/setbookmark.htm";
	popW = 620;
	popH = 371;
	popSet = 0; // 1 = Pop-under, 0 = Pop-up

	var winLeft = (screen.width - popW) / 2;
	var winUp = (screen.height - popH) / 2;

	windowsettings = window.open(URL,'remote','width=' + popW + ',height=' + popH + ',left=' + winLeft + ',top=' + winUp + ',resizable=0')
	if (popSet==1)
	{
		windowsettings.blur()
		window.focus()
	}
}

function AddCommas(num){
// Check to see if the number needs any commas
num = num + '';
if (num.length > 3) {
// Figure out how many commas need to go in
var count;
var numcommas;

count = 0;
numcommas = 0;
while (count < num.length) {
count = count + 3;
if (count < num.length) {
numcommas = numcommas + 1;
}
}

// Put the commas in.
var NewNumber;
var TempNumber;

count = 0;
TempNumber = num;
NewNumber = '';
for(count = 0; count < numcommas; count++) {
NewNumber = ',' + TempNumber.substring(TempNumber.length - 3,TempNumber.length) + NewNumber;
TempNumber = TempNumber.substring(0, TempNumber.length - 3);
}
NewNumber = TempNumber + NewNumber;
document.write(NewNumber);
} else {
// Number is less then 3 and doesnt need any commas.
// Just print the number.
document.write(num);
}
}

// Read Cookie
function getCookie(Name) {
	var search = Name + "=";
	if (document.cookie.length > 0) {
	  	offset = document.cookie.indexOf(search);
			if (offset != -1) {
      			offset += search.length;	// set index of beginning of value         
		      	end = document.cookie.indexOf(";", offset);  // set index of end of cookie value         
      			if (end == -1) end = document.cookie.length;
		      	return unescape(document.cookie.substring(offset,end));
		}
	}
}

// Set Cookie
function setCookie(name, value, expire) {   
	document.cookie = name + "=" + escape(value)   + ((expire == null) ? "" : ("; expires=" + expire.toGMTString()))
}

function getCookie(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 toggle(id){
	var liArray = new Array("li_news","li_reviews","li_columns","li_vpagephotos");
	var divArray = new Array("div_news","div_reviews","div_columns","div_vpagephotos");

	var li = "li_" + id;
	var div = "div_" + id;
	var i

	for(i=0;i<4;i++){

		if (liArray[i] == li){
			if (document.getElementById(liArray[i]).className == 'li_off'){
				document.getElementById(liArray[i]).className = "li_on";
			}
		}
		else
		{
			if (document.getElementById(liArray[i]).className == 'li_on'){
				document.getElementById(liArray[i]).className = "li_off";
			}
		}//end li
	}
	for(i=0;i<4;i++){

		if (divArray[i] != div){
			if (document.getElementById(divArray[i]).className == 'openn'){
				document.getElementById(divArray[i]).className = "closed";
			}
		}
		else
		{
			if (document.getElementById(divArray[i]).className == 'closed'){
				document.getElementById(divArray[i]).className = "openn";
			}
		}//end div
		
	}//end for
	
}

function srCount(s,t){
	var starting=s
	var total=t;
	if (20<total){
		document.write(starting+" - "+(starting+19)+" of "+ total);
	}
	else
	{
		document.write(starting+' - ' + total);
	}
}

function md(d,q,m){
	// remove the &quot; so highlighting on article page works
	myDisplay = m; 
	if (myDisplay.indexOf('%26quot%3B') != -1){
		myDisplay = myDisplay.substring(10,myDisplay.length-10);
	}
	document.write('<a href=av_result.asp?articleid='+d+'&query='+q+'&display='+myDisplay+'>');
}
