// JavaScript Document


// jobs email
var contact = "email"
var email = "venan.jobs"
var emailHost = "venan.com"

// support
var s1 = "customer"
var s2 = ".support"
var s3 = "@"

// info
var icontact = "info"


// AJAX GAMES SCRIPT TO PREVENT PAGE RELOAD
/*States
    * 0 (uninitialized)
    * 1 (loading)
    * 2 (loaded)
    * 3 (interactive)
    * 4 (complete) 
*/


function makeRequest(url, menudiv) {
	var http_request = false;

	if (window.XMLHttpRequest) { // Mozilla, Safari, ...
		http_request = new XMLHttpRequest();
		if (http_request.overrideMimeType) {
			http_request.overrideMimeType('text/xml');
			// See note below about this line
		}
	} else if (window.ActiveXObject) { // IE
		try {
			http_request = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try {
				http_request = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e) {}
		}
	}

	if (!http_request) {
		alert('Giving up :( Cannot create an XMLHTTP instance');
		return false;
	}
		http_request.onreadystatechange = function() { alertContents(http_request, menudiv); };
		http_request.open('GET', url, true);
		http_request.send(null);

}

function alertContents(http_request, menud) {

	if (http_request.readyState == 1) {
		document.getElementById(menud).innerHTML = /* document.getElementById('dataDump').innerHTML; */ "<p>Loading...</p>";
	}
	
	if (http_request.readyState == 4) {
		if (http_request.status == 200) {
			document.getElementById(menud).innerHTML = (http_request.responseText);
		} else {
			alert('Sorry.  There was a problem with the request.');
		}
	}

}



function clearDiv(divname) {
	document.getElementById(divname).innerHTML = "";
}


function writeTitle(title) {
	document.getElementById('titlediv').innerHTML = title;
	}
	
	
	
	
	
	
	
//MM Functions
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

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_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}





//Light flicker uses code from "The Animated Candle and Accounting" by Thomas James Allen
//Jim Allen email: tjallen@pipeline.com 
//The Animated Candle and Accounting and its html and javascript code are
//copyright 2000 by Thomas James Allen
/*
	if (document.images) {
	var neon=new Array();
	neon[0]=new Image(); neon[0].src="images/header.jpg";
	neon[1]=new Image(); neon[1].src="images/header_off.jpg";
	neon[2]=new Image(); neon[2].src="images/header.jpg";
	neon[3]=new Image(); neon[3].src="images/header.jpg";
	neon[4]=new Image(); neon[4].src="images/header.jpg";
	neon[5]=new Image(); neon[5].src="images/header.jpg";
	neon[6]=new Image(); neon[6].src="images/header.jpg";
	neon[7]=new Image(); neon[7].src="images/header.jpg";
	neon[8]=new Image(); neon[8].src="images/header.jpg";
	neon[9]=new Image(); neon[9].src="images/header.jpg";
	neon[10]=new Image(); neon[10].src="images/header.jpg";
	neon[11]=new Image(); neon[11].src="images/header.jpg";
	neon[12]=new Image(); neon[12].src="images/header.jpg";
	neon[13]=new Image(); neon[13].src="images/header.jpg";
	neon[14]=new Image(); neon[14].src="images/header.jpg";
	}
		
	function flicker(){
		var maxtime = 60;
		var mintime = 10;
		
		var bRand = 0;
		bRand = Math.random();
		bRand = Math.floor(bRand * (maxtime-mintime)) + mintime;
		
		var howmany = 15;
		var cRand = 0;
		cRand = Math.random();
		cRand = Math.floor(cRand * howmany);
		
		document.header.src = neon[cRand].src;
		
		mytimer = setTimeout("flicker()",bRand);
	}
	
*/	

//SUPPORT DROP LIST DATA

function fillCategory(){ 
 // this function is used to fill the category list on load
addOption(document.supportForm.AppName, "-----------", "--- Select App ---", "");
addOption(document.supportForm.AppName, "Space Miner HD", "Space Miner HD", "");
addOption(document.supportForm.AppName, "Space Miner Blast", "Space Miner Blast", "");
addOption(document.supportForm.AppName, "Space Miner", "Space Miner: Space Ore Bust", "");
addOption(document.supportForm.AppName, "Trees of Doom!", "Ninjatown: Trees of Doom!", "");
addOption(document.supportForm.AppName, "Trees of Doom! HD", "Ninjatown: Trees of Doom! HD", "");
addOption(document.supportForm.AppName, "Book of Heroes", "Book of Heroes", "");
//SelectAppVers();
}

function SelectAppVers(){
// ON selection of category this function will work

	removeAllOptions(document.supportForm.AppVers);
//	addOption(document.supportForm.AppVers, "", "AppVers", "");
	
	if(document.supportForm.AppName.value == 'Space Miner HD'){
		addOption(document.supportForm.AppVers,"1.4.2", "1.4.2");
		addOption(document.supportForm.AppVers,"1.4.0", "1.4.0");
		addOption(document.supportForm.AppVers,"1.3.1", "1.3.1");		
	}
	if(document.supportForm.AppName.value == 'Space Miner Blast'){
		addOption(document.supportForm.AppVers,"1.1.0", "1.1.0");
		addOption(document.supportForm.AppVers,"1.0.1", "1.0.1");		
		addOption(document.supportForm.AppVers,"1.0.0", "1.0.0");
	}	
	if(document.supportForm.AppName.value == 'Space Miner'){
		addOption(document.supportForm.AppVers,"1.4.2", "1.4.2");
		addOption(document.supportForm.AppVers,"1.4.1", "1.4.1");
		addOption(document.supportForm.AppVers,"1.4.0", "1.4.0");
		addOption(document.supportForm.AppVers,"1.3.2", "1.3.2");
		addOption(document.supportForm.AppVers,"1.3.0", "1.3.0");
		addOption(document.supportForm.AppVers,"1.2.2", "1.2.2");
		addOption(document.supportForm.AppVers,"1.2.1", "1.2.1");
		addOption(document.supportForm.AppVers,"1.2.0", "1.2.0");
		addOption(document.supportForm.AppVers,"1.1.1", "1.1.1");
		addOption(document.supportForm.AppVers,"1.0.1", "1.0.1");
	}
	if(document.supportForm.AppName.value == 'Trees of Doom!'){
		addOption(document.supportForm.AppVers,"1.6.1", "1.6.1");
		addOption(document.supportForm.AppVers,"1.6.0", "1.6.0");
		addOption(document.supportForm.AppVers,"1.5.1", "1.5.1");
		addOption(document.supportForm.AppVers,"1.4.0", "1.4.0");
		addOption(document.supportForm.AppVers,"1.3.0", "1.3.0");
		addOption(document.supportForm.AppVers,"1.2.0", "1.2.0");
		addOption(document.supportForm.AppVers,"1.1.0", "1.1.0");
		addOption(document.supportForm.AppVers,"1.0.0", "1.0.0");
	}
	if(document.supportForm.AppName.value == 'Trees of Doom! HD'){
		addOption(document.supportForm.AppVers,"1.6.1", "1.6.1");
		addOption(document.supportForm.AppVers,"1.6.0", "1.6.0");
		addOption(document.supportForm.AppVers,"1.5.1", "1.5.1")
		addOption(document.supportForm.AppVers,"1.4.0", "1.4.0")
		addOption(document.supportForm.AppVers,"1.3.1", "1.3.1");
		addOption(document.supportForm.AppVers,"1.3.0", "1.3.0");
	}
	if(document.supportForm.AppName.value == 'Book of Heroes'){
		addOption(document.supportForm.AppVers,"1.1.1", "1.1.1")
		addOption(document.supportForm.AppVers,"1.1.0", "1.1.0")
		addOption(document.supportForm.AppVers,"1.0.0", "1.0.0")

	}	

}
////////////////// 

function removeAllOptions(selectbox)
{
	var i;
	for(i=selectbox.options.length-1;i>=0;i--)
	{
		//selectbox.options.remove(i);
		selectbox.remove(i);
	}
}


function addOption(selectbox, value, text )
{
	var optn = document.createElement("OPTION");
	optn.text = text;
	optn.value = value;
	if(value=="-----------"){optn.setAttribute("selected","selected");}
	selectbox.options.add(optn);
}

