function readRevID() {
	var expDays = 365; // number of days the cookie should last
	var expDate = new Date();
	expDate.setTime(expDate.getTime() +  (24 * 60 * 60 * 1000 * expDays));
	var revid = GetCookie('revid');
	//alert("revId is: " + revid);
	if (revid == null || revid == "") {
		if (location.search.length > 1) revid = location.search.substring(1,location.search.length);
		else revid = "";
		if (revid != GetCookie('revid')) SetCookie('revid', revid, expDate);
		//alert("settuing cookie with: [" + revid + "]");
		if(revid.length>2){
			SetCookie('doPop',true,expDate);
		}
	}
	if(fromUltra()){
		SetCookie('revid', 'ultrasites', expDate);
		SetCookie('doPop',true,expDate);
	}
	if(fromSponsor()){
		SetCookie('doPop',true,expDate);
	}
// You can change the FORM location below
// where the referral ID is stored on your page
// You then access this element to get the ID
}

function readRefID(){
	var expDays = 365; // number of days the cookie should last
	var expDate = new Date();
	expDate.setTime(expDate.getTime() +  (24 * 60 * 60 * 1000 * expDays));
	var jfref = GetCookie('jfref');
	//alert("revId is: " + revid);
	if (jfref == null || jfref == "") {
		jfref = document.referrer;
		SetCookie('jfref', jfref, expDate);
	}
}
//function getRefEmetrix(){
//	var ref = getCookie("revid");
//	if(ref.length>15){
//		ref = ref.substring(0,14);
//	}
//	return "&ID=" + ref;
//}
function getRefEmetrix(){
	var ref = getCookie("revid");
	if((ref != null)&&(ref.length>1)){
		if(ref.length>15){
			ref = ref.substring(0,14);
		}
		return "&ID=" + ref;
	}
	else{
		var rev = getCookie("jfref");
		if(rev != null){
			return "&ID=REFER:" + rev;
		}
	}
	return "";
}

function goToFileLocker(location){
        //var url = "http://www.lockyourfiles.com";
        var revid = GetCookie('revid');
        if(revid == null || revid == ""){
                //do nothing
        }
        else{
                location = location + "?" + revid;
        }
        open(location);
        //alert("url is: " + url);
}

function getCookieVal (offset) {
var endstr = document.cookie.indexOf (";", offset);
if (endstr == -1)
endstr = document.cookie.length;
return unescape(document.cookie.substring(offset, endstr));
}
function GetCookie (name) {
var arg = name + "=";
var alen = arg.length;
var clen = document.cookie.length;
var i = 0;
while (i < clen) {
var j = i + alen;
if (document.cookie.substring(i, j) == arg)
return getCookieVal (j);
i = document.cookie.indexOf(" ", i) + 1;
if (i == 0) break;
}
return null;
}
function SetCookie (name, value) {
var argv = SetCookie.arguments;
var argc = SetCookie.arguments.length;
var expires = (argc > 2) ? argv[2] : null;
var path = (argc > 3) ? argv[3] : null;
var domain = (argc > 4) ? argv[4] : null;
var secure = (argc > 5) ? argv[5] : false;
document.cookie = name + "=" + escape (value) +
((expires == null) ? "" : ("; expires=" + expires.toGMTString())) +
((path == null) ? "" : ("; path=" + path)) +
((domain == null) ? "" : ("; domain=" + domain)) +
((secure == true) ? "; secure" : "");
}
var bikky = document.cookie;
function getCookie(name) { // use: getCookie("name");

    var index = bikky.indexOf(name + "=");
    if (index == -1) return ("");
    index = bikky.indexOf("=", index) + 1; // first character
    var endstr = bikky.indexOf(";", index);
    if (endstr == -1) endstr = bikky.length; // last character
    var endval = unescape(bikky.substring(index, endstr));
    //if(isBanned(endval)){
	  //	document.location="http://www.faughnan.com/ccfraud.html";
	  //}
	  return endval;
}



//my stuff
function isBanned(name){
	var banned = ['aheole','andoni','zakhriza','dentio','KR2004','adhiez','allgames','centuryc','dodol123','andonik','century','jfuseagent','shigar','bisnis19','ade25','sant0s','maxfider','thomblock','davidu','bamby','andy','pithiq','homebuying','superbuying','taufieq','wedhusbalap','TheSun','kere','doni','liane','bagus','seagate','thomblock2','dezperado','pasoepati','kc_pion','the_great','mokori','Singolawu','DUCK','sitanggang','wisnu','ucup','blaze','cezzy','xxxxx','cezzperado','anch4site','wawan','cupid','arjun','nandita'];
	for(i=0;i<banned.length;i++){
		if(banned[i]==name){
			return true;
		}
	}
	return false;
}
var sponsors = ['video-post.com','vidsvidsvids.com'];
var NS = (navigator.appName =='Netscape');
var pop = "pop1.html" ;
function fromSponsor(){
	for(i=0;i<sponsors.length;i++){
		if(document.referrer.indexOf(sponsors[i]) != -1){
			return true;
		}
	}
	return false;
}
function getPop(){
	return pop;
}

function fromUltra(){
	 //alert(document.referrer);
	if(document.referrer.indexOf("ultra")!= -1){
	//if(document.referrer.indexOf("softbux.com")!= -1){
		return true;
	}
	else{
		return false;
	}
}
function doPop(){
	//alert(GetCookie('doPop'));
	//if(GetCookie('doPop')) return true;
	//else return false;
	return true;
}

function wasReferred(){
	var revid = GetCookie('revid');
	if (revid == null || revid == "") {
		return false;
	}
	else{
		return true;
	}
}
function openDemo(path){
	var ansWin = null;
	if (ansWin != null) {
		if (!ansWin.closed) {
			ansWin.close();
		}
	}
	if(NS){
		ansWin = window.open(path,'ansWin','width=550,height=415,scrollbars=NO,screenX=10,screenY=10');
	}
	else{
		ansWin = window.open(path,'ansWin','width=550,height=415,scrollbars=NO');
	}
}
function openPage(path){
	var ansWin = null;
	if (ansWin != null) {
		if (!ansWin.closed) {
			ansWin.close();
		}
	}
	if(NS){
		ansWin = window.open(path,'ansWin','width=700,height=700,scrollbars=YES,screenX=10,screenY=10');
	}
	else{
		ansWin = window.open(path,'ansWin','width=700,height=700,scrollbars=YES,left=10,top=10');
	}
}
function openSmallPage(path){
	var ansWin = null;
	if (ansWin != null) {
		if (!ansWin.closed) {
			ansWin.close();
		}
	}
	if(NS){
		ansWin = window.open(path,'ansWin','width=600,height=500,scrollbars=YES,screenX=10,screenY=10');
	}
	else{
		ansWin = window.open(path,'ansWin','width=600,height=500,scrollbars=YES,left=10,top=10');
	}
}

function fillTotal(){
	for(var i=0;i<document.forms[0].elements.length;i++){
		if(document.forms[0].elements[i].checked){
			document.forms[0].elements[6].value="$" + document.forms[0].elements[i].value;
		}
	}
}

function submitEmailForm(){
	var form = document.forms[0];
        var error = false;
        var msg = "The email address you entered is not valid.\nPlease enter a valid email address to recieve the Jfuse newsletter.\n";
        if(form.elements[0].value.length<2){
                error = true;
        }
        if(form.elements[0].value.indexOf("@")<0){
        	error = true;
        }
        if(error){
        	alert(msg);
        }
        else{
        	form.submit();
        }
}
function getInputName(num){
	if(num == 1){
		return "x_Header_Email_Receipt";
	}
	if(num == 2){
		return "x_Receipt_Link_Text";
	}
	if(num == 3){
		return "x_Receipt_Link_URL";
	}

}
function getInputValue(num){
	if(num == 1){
		return "Your order has been received and will be shipped out within 2-3 business days. If you would like to download Jfuse and regigister it before you receive the cd, your registration number is:  746978";
	}
	if(num == 2){
		return "Please continue to the page below for complete registration instructions.";
	}
	if(num == 3){
		return "http://www.jfuse.com/cgi-bin/registered.pl";
	}
}

/*********************************************
************stuff Bill did********************
**********************************************/

function doIt(_n,_v)
{
  if(typeof _n == "undefined" ||
     typeof _v == "undefined")
  {
    alert("You did not define both parameters.");
	return;
  }
  if (_v)
  {
    //mouse over
	if(_n==2)
	{
      document.all.pic1.src=_imgs[7].src;
      document.all.pic2.src=_imgs[1].src;
	}
	else if(_n==4)
	{
      document.all.pic1.src=_imgs[8].src;
      document.all.pic3.src=_imgs[2].src;
	}
   else if(_n==6)
	{
      document.all.pic1.src=_imgs[9].src;
      document.all.pic4.src=_imgs[3].src;
	}
	else if(_n==8)
	{
      document.all.pic1.src=_imgs[10].src;
      document.all.pic5.src=_imgs[4].src;
	}
	else if(_n==10)
	{
      document.all.pic1.src=_imgs[11].src;
      document.all.pic6.src=_imgs[5].src;
	}
	else if(_n==12)
	{
      document.all.pic1.src=_imgs[12].src;
      document.all.pic7.src=_imgs[6].src;
	}
	else
	{
	  alert("MOUSEIN:\n_n was not handled:\n\t"+_n);
	  return;
	}
  }
  else
  {
    // mouse out
	if(_n==2)
	{
      document.all.pic1.src=_imgs[0].src;
      document.all.pic2.src=_imgs[1].src;
	}
	else if(_n==4)
	{
      document.all.pic1.src=_imgs[0].src;
      document.all.pic3.src=_imgs[2].src;
	}
   else if(_n==6)
	{
      document.all.pic1.src=_imgs[0].src;
      document.all.pic4.src=_imgs[3].src;
	}
	else if(_n==8)
	{
      document.all.pic1.src=_imgs[0].src;
      document.all.pic5.src=_imgs[4].src;
	}
	else if(_n==10)
	{
      document.all.pic1.src=_imgs[0].src;
      document.all.pic6.src=_imgs[5].src;
	}
	else if(_n==12)
	{
      document.all.pic1.src=_imgs[0].src;
      document.all.pic7.src=_imgs[6].src;
	}
	else
	{
	  alert("MOUSEOUT:\n_n was not handled:\n\t"+_n);
	  return;
	}
  }
}
var exit=false; //turn popups on or off
function notyet() {
var NS = (navigator.appName =='Netscape');
//alert("dopop is" + doPop());
	if ((exit) && (doPop())){
		if(NS){
			open(getPop(),"new_window","toolbar=no,menubar=no,location=no, scrollbars=yes,height=300,width=300,screenX=10,screenY=10");
		}
		else{
			open(getPop(),"new_window","toolbar=no,menubar=no,location=no, scrollbars=yes,height=300,width=300");

		}
	}
}

var _imgs = new Array();
 _imgs[0] = new Image(); _imgs[0].src="images/header3_11g.gif";
 _imgs[1] = new Image(); _imgs[1].src="images/header3_07a.gif";
 _imgs[2] = new Image(); _imgs[2].src="images/header3_07b.gif";
 _imgs[3] = new Image(); _imgs[3].src="images/header3_07c.gif";
 _imgs[4] = new Image(); _imgs[4].src="images/header3_15b.gif";
 _imgs[5] = new Image(); _imgs[5].src="images/header3_15c.gif";
 _imgs[6] = new Image(); _imgs[6].src="images/header3_15d.gif";
 _imgs[7] = new Image(); _imgs[7].src="images/header3_11a.gif";
 _imgs[8] = new Image(); _imgs[8].src="images/header3_11b.gif";
 _imgs[9] = new Image(); _imgs[9].src="images/header3_11c.gif";
 _imgs[10] = new Image(); _imgs[10].src="images/header3_11d.gif";
 _imgs[11] = new Image(); _imgs[11].src="images/header3_11e.gif";
 _imgs[12] = new Image(); _imgs[12].src="images/header3_11f.gif";

 function viewImage(path){
	var ansWin = null;
	if (ansWin != null) {
		if (!ansWin.closed) {
			ansWin.close();
		}
	}
	if(NS){
		ansWin = window.open(path,'ansWin','width=700,height=700,scrollbars=YES,screenX=10,screenY=10');
	}
	else{
		ansWin = window.open(path,'ansWin','width=700,height=700,scrollbars=YES,left=10,top=10');
	}
}
function submitForm(num) {
 document.forms[num].submit();
}