<!--

// Check browser type
var isIE =  false;  // MSIE
var isNav = false;  // NetScape Navigator (4.X)
var isMo =  false;  // NetScape Mozilla 6 (5.X)

if (navigator.appName.indexOf('Netscape') != -1) {
	var sname = navigator.appVersion.substr(0,3);
	isMo = (sname.indexOf('5') == 0)? true : false;
	isNav = (isMo)? false : true;
}
// Assume IE if not MO or NAV
isIE = (isNav || isMo)? false : true ;

// Check browser platform
var isMac =false;
var isPC  =false;
isMac = (navigator.platform.indexOf('Mac') != -1)? true : false ;
isPC  = (isMac)? false : true ; // Assume PC

function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  
  if(!d) d=document; 
  if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);
  }
  if(!(x=d[n])&&d.all) x=d.all[n]; 
  for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); 
  return x;
}

function MM_showHideLayers() { //v3.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v='hide')?'hidden':v; }
    obj.visibility=v; }
}

function openWindow(theUrl, theWidth, theHeight){
  winx=window.open(theUrl,'openWindow','width=' + theWidth + ',height=' + theHeight + ',scrollbars=no,menubar=no,status=no,resizable=1');
  winx.moveTo(screen.width/2-(theWidth/2),screen.height/3-(theHeight/2));
}

function openWindowScroll(theUrl, theWidth, theHeight){
  winx=window.open(theUrl,'openWindow','width=' + theWidth + ',height=' + theHeight + ',scrollbars=yes,menubar=no,status=no,resizable=1');
  winx.moveTo(screen.width/2-(theWidth/2),screen.height/3-(theHeight/2));
}

function focusWindow(){
  theTimer = window.setTimeout("self.focus()", 100);
}

function disableForm(form_name, toggle) {
	document.forms[form_name].disabled = toggle;
	document.forms[form_name].submit.disabled = toggle;
} // function toggldForm

function numDays() {
	start_date = new Date(document.theform.start_year.value,document.theform.start_month.value -1,document.theform.start_day.value,0,0,0,0);
	end_date = new Date(document.theform.end_year.value,document.theform.end_month.value -1,document.theform.end_day.value,0,0,0,0);
	today_date = new Date();
	today_date.setHours(0,0,0,0);
	date_diff = end_date.getTime() - start_date.getTime();
	clear = true;
	// check for end before start...
	if (date_diff<0) {
		days = "ERROR: End date before start date.";
		disableForm("theform",true);
		clear = false;
	} // if
	else if (date_diff==0)  {
		days = 1;
		disableForm("theform",false);
	} // else if
	else {
		days = Math.round(date_diff / (1000*60*60*24)) +1 ;
		disableForm("theform",false);
	} // else 
	if (clear) {
		// check for modifying past...
		if (start_date<=today_date) {
			days = "ERROR: Start date is before or is today.";
			disableForm("theform",true);
			clear = false;
		} // if
	} // if
	document.theform.days.value = days;
} // function numDays

function checkAds() {
	if (!(Math.round(document.theform.views.value))) { 
		document.theform.error.value = "ERROR: Views per day must be a number.";
		disableForm("theform",true);
	} // if
	else if (Math.floor(document.theform.views.value)<=0) {
		document.theform.error.value = "ERROR: Views per day must be greater than 0.";
		disableForm("theform",true);
	} // else if
	else if (document.theform.days.value * document.theform.views.value > document.theform.view_remain.value) {
		document.theform.error.value = "ERROR: Potential views exceeds available.";
		disableForm("theform",true);
	} // else if
	else {	
		document.theform.views.value = Math.floor(document.theform.views.value);
		document.theform.error.value = "";
		disableForm("theform",false);
		numDays();
	} // else 
} // function checkAds


function getAnime() {
	var args = getAnime.arguments;
	// Check if browser supports getElementByID...
	if (document.getElementById) {
		var x = (window.ActiveXObject) ? new ActiveXObject("Microsoft.XMLHTTP") : new XMLHttpRequest();
	} // if
	// Browser support it.  If not, nothing happens...
	if (x) {
		thisAnime = document.getElementById("thisAnime");
		thisAnime.innerHTML = '<div id="myAnimeID">' + args[0] + '</div><div id="myTitle">' + args[1] + '</div>';
		thisAnime.style.visibility = "visible";
	} // if 
} // function getAnime

function placeAnime() {
	// Check if browser supports getElementByID...
	if (document.getElementById) {
		var x = (window.ActiveXObject) ? new ActiveXObject("Microsoft.XMLHTTP") : new XMLHttpRequest();
	} // if
	// Browser support it.  If not, nothing happens...
	if (x) {
		thisAnime = document.getElementById("thisAnime");
		thisAnime.style.visibility = "hidden";
	} // if 
} // function placeAnime

//Expandable menu functions

function setboxcookie(value) {
	var today = new Date();
	today.setTime( today.getTime() );
	var expires = 123 * 1000 * 60 * 60 * 24;
	var expires_date = new Date( today.getTime() + (expires) );
	document.cookie = "showboxes=" + escape(value) + ";expires=" + expires_date.toGMTString() + ";path=/";
}

function getboxcookie() {
	var start = document.cookie.indexOf( "showboxes=" );
	var len = start + 10;
	if ((!start) && ( name != document.cookie.substring(0, name.length)))  return null;
	if (start == -1) return null;
	var end = document.cookie.indexOf(";", len);
	if (end == -1) end = document.cookie.length;
	return unescape(document.cookie.substring(len, end));
}

function initboxcookie(){
	if (getboxcookie() == null) setboxcookie(65024); 
}

function showBoxImg(name) {
	var bit = name.lastIndexOf("_");
	if (!bit) return;
	bit = parseInt(name.substring(bit+1, name.length));
	if (parseInt(getboxcookie()) & (1 << bit)) {
  		document.write("<img name=\"img_" + name + "\" src=\"/_media/close-menu.png\" border=\"0\" /> ");
	} else {
  		document.write("<img name=\"img_" + name + "\" src=\"/_media/expand-menu.png\" border=\"0\" /> "); 
	}
}

function showBoxData(name) {
	var bit = name.lastIndexOf("_");
	if (!bit) return;
	bit = parseInt(name.substring(bit+1, name.length));
	if (parseInt(getboxcookie()) & (1 << bit)) {
  		document.write("<li id=\"" + name + "\" style=\"display: block; padding: 0px 0px 0px 0px; border: 0px; background-color: transparent;\">");
	} else {
  		document.write("<li id=\"" + name + "\" style=\"display: none; padding: 0px 0px 0px 0px; border: 0px; background-color: transparent;\">");
	}
}

function switchit(list){
	var imgName = "img_" + list;
	var listElementStyle=document.getElementById(list).style;
	var imageData=document.getElementById(imgName);

	var bit = list.lastIndexOf("_");
	if (!bit) return;
	bit = parseInt(list.substring(bit+1, list.length));

	if (listElementStyle.display=="none"){
		listElementStyle.display="block";
		document[imgName].src="/_media/close-menu.png";
  		setboxcookie(parseInt(getboxcookie()) | (1 << bit));
	} else {
		listElementStyle.display="none";
		document[imgName].src="/_media/expand-menu.png";
  		setboxcookie(parseInt(getboxcookie()) & (~(1 << bit)));
	}
}
initboxcookie();

//End expandable menu functions

//-->