// By Berry Jordaan

//a function to set a cookie
function setCookie(path,input) 
{
	var splitInput = input.split(",");
	var myCookie= "lobotomy|"
	for (i=0; i<splitInput.length; i++){
		myCookie= myCookie+splitInput[i]+",";
	}

	var expiryDays = 60*24*60*60*1000;
	// Expire in 60 days
	var exp = new Date(); 
	exp.setTime(exp.getTime() + (expiryDays));
	var expiry =  exp.toGMTString();
	document.cookie = myCookie+";expires=" + expiry;
}


function getCookie(){
	if(document.cookie != ''){
		var cookie_value=document.cookie.split('|');
		return  cookie_value[1];
	}else{
		//default settings
		return  ['none','high'];
	}	
}


function index_DoFSCommand(command, args) {
	//to set the variables in the flash movie
	//window.document.index.SetVariable("debug", args);
	if(command=="get_settings"){
	the_array=getCookie();
	window.document.index.SetVariable("cookie_array",the_array);
	}
}

// this is need for the flash to talk to java.
if (navigator.appName && navigator.appName.indexOf("Microsoft") != -1 && 
	  navigator.userAgent.indexOf("Windows") != -1 && navigator.userAgent.indexOf("Windows 3.1") == -1) {
	document.write('<SCRIPT LANGUAGE=VBScript\> \n');
	document.write('on error resume next \n');
	document.write('Sub index_FSCommand(ByVal command, ByVal args)\n');
	document.write('  call index_DoFSCommand(command, args)\n');
	document.write('end sub\n');
	document.write('</SCRIPT\> \n');
}

//stagger fx, called by flash
function stagger_fn(x,y){
self.moveBy(x,y);
}

// Certificate popup
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}
