//subscription code below
/*subImage_opened = new Image();
	subImage_opened.src =  "animskul.gif";
	subImage_closed = new Image();
	subImage_closed.src =  "sunset.jpg";
*/
IE = (document.all)
NS = (document.layers)
browserName = navigator.appName;
browserVer = parseInt(navigator.appVersion);
var NS6 = false;
var IeMac45 = false;
var subIsOpen = false;    
var wiperWorking = false;
MAC = (navigator.appVersion.indexOf("Mac") != -1);
var determined_position;

if ( (navigator.appVersion.indexOf('Mac') != -1 ) && navigator.appVersion.indexOf('4.5') != -1 && (IE) ) {
	IeMac45 = true;
}

 keyin_1 = new Image(184,23);  keyin_1.src = "images/photo-platinum.jpg";
 keyin_2 = new Image(184,23);  keyin_2.src = "images/photo-olb.jpg";
 keyin_3 = new Image(184,23);  keyin_3.src = "images/photo-billpay.jpg";		  
//positioning stuff 
var holdingImage = document.images["homepic"];
var count = 2;
if(holdingImage){
   
    var canvasLeft = (document.layers) ? holdingImage.x : getRealLeft(holdingImage);
    var canvasTop = (document.layers) ? holdingImage.y : getRealTop(holdingImage);
    var canvasWidth = holdingImage.width;
    var canvasHeight = holdingImage.height;
    determined_position = canvasLeft;
    if(!NS){
        document.all["hpsubscribetab"].style.left = canvasLeft;
        document.all["hpsubscribetab"].style.top = canvasTop;
        document.all["hpsubscribeform"].style.left = canvasLeft;
        document.all["hpsubscribeform"].style.top = canvasTop+5;
    }
    else{
         document.layers["hpsubscribetab"].left = canvasLeft;
         document.layers["hpsubscribetab"].top = canvasTop;
         document.layers["hpsubscribeform"].left = canvasLeft;
         document.layers["hpsubscribeform"].top = canvasTop+5;
    }
}

var x;
function init() {
setInterval("wiper()",5000); 
    if((browserName=="Netscape")&&(browserVer>5)){
    NS6 = true;
}
	if (NS) block = document.hpsubscribeform;
	if (IE) {
        block = hpsubscribeform.style;
        BrwWidthE = document.body.clientWidth; //for use in didResize 
    }
    
	if (IeMac45 || (MAC && IE)) { fixIeMac45() };
	if (NS) {
		BrwWidth = window.innerWidth; //for use in didResize
		BrwHeight = window.innerHeight; //for use in didResize
	}   
}


function reDo() {
	location.reload();
}

function didResize() { //netscape function to determine if window is resized
	BrwWidthx = window.innerWidth;
	BrwHeightx = window.innerHeight;
	if (BrwWidthx != BrwWidth || BrwHeight != BrwHeightx) {
		location.reload();
	}
}

if (NS) {
	window.captureEvents(Event.RESIZE);
	window.onresize = didResize;
}

function fixIeMac45() {
	document.all.hpsubscribeform.style.left = -300;
	block.clip = "rect(0px 200px 245px 0px)";
}

function clipValues(obj,which) {
	if (NS) {
		if (which=="t") return obj.clip.top
		if (which=="r") return obj.clip.right
		if (which=="b") return obj.clip.bottom
		if (which=="l") return obj.clip.left
	} else if (IE) {
		var clipv = obj.clip.split("rect(")[1].split(")")[0].split("px")
		if (which=="t") return Number(clipv[0])
		if (which=="r") return Number(clipv[1])
		if (which=="b") return Number(clipv[2])
		if (which=="l") return Number(clipv[3])
	}
}

function clipBy(obj,t,r,b,l) {
	if (NS) {
		obj.clip.top = clipValues(obj,'t') + t
		obj.clip.right = clipValues(obj,'r') + r
		obj.clip.bottom = clipValues(obj,'b') + b
		obj.clip.left = clipValues(obj,'l') + l
	} else if (IE) { 
		obj.clip = "rect("+(this.clipValues(obj,'t')+t)+"px "+(this.clipValues(obj,'r')+r)+"px "+Number(this.clipValues(obj,'b')+b)+"px "+Number(this.clipValues(obj,'l')+l)+"px)";
	}
}


function wiper() {
      
    
	if (NS) {
		if (parseInt(document.hpsubscribetab.left) == determined_position) {//724 is the left that is set in the style sheet
			wipe1();
		} else {
			wipe2();
		}
	}	

	if (IE && !MAC) {
		if (parseInt(document.all.hpsubscribetab.offsetLeft) == determined_position) {
			wipe1();
		} else {
            
			wipe2();
		}  
	} else if (!NS && parseInt(document.all.hpsubscribetab.offsetLeft) == determined_position) {
		document.all.hpsubscribetab.style.left = determined_position;
		document.all.hpsubscribeform.style.left = determined_position;
		
	} 
}

var counter= 0;
function wipe1() {
	if (clipValues(block,'l')>0) {
    //alert("clip   " + clipValues(block,'l'));
		clipBy(block,0,0,0,-5);
		
		if (NS) {
			counter = parseInt(document.hpsubscribetab.left);
			counter = counter - 5;
			document.hpsubscribetab.left = counter;
            if(counter <= 355){
             changeImage(count);  
    		}
            
		}
		
		if (IE) {
    		counter = parseInt(document.all.hpsubscribetab.offsetLeft);
    		counter = counter - 5;
    		document.all.hpsubscribetab.style.left = counter;
            if(counter <= 353){
             changeImage(count);  
    		}
		}
		setTimeout("wipe1()",30);
	}
   
        
       
}

function wipe2() {
//	(NS) ? document.hpheader.document.forms[0].elements[0].focus() : document.forms[0].elements[0].focus();
	//(NS) ? document.hpsubscribeform.document.subform.EmailAddr.blur() : document.subform.EmailAddr.blur();  Erron commented out

	if (clipValues(block,'l')<188) {
        
		clipBy(block,0,0,0,5)
		
		if (NS) {
			counter = parseInt(document.hpsubscribetab.left);
			counter = counter + 5;
			document.hpsubscribetab.left = counter;
			if (counter == determined_position) {
                
				 if(count == 2){
                    count = 1;
                 }
                 else if(count==1){
                 count = 2;
                 }            				
			}
		}
		
		if (IE) {
			counter = parseInt(document.all.hpsubscribetab.offsetLeft);
            
			counter = counter + 5;
			document.all.hpsubscribetab.style.left = counter;
			if (counter == determined_position) {
				 if(count == 2){
                    count = 1;
                 }
                 else if(count==1){
                 count = 2;
                 }            				
			}
		}
		setTimeout("wipe2()",30);
	}
    
}


function changeImage(which) {
	if (NS) {
		document.images['keyin'].src = eval('keyin_' + which + '.src');
	}
	if (IE) {
		document.images['keyin'].src = eval('keyin_' + which + '.src');
	}
	if (which == 'opened') {
		//(NS) ? document.hpsubscribeform.document.subform.EmailAddr.focus() : document.subform.EmailAddr.focus();
		//if (IE) {Erron commented out
			//document.subform.EmailAddr.focus();  Erron commented out
		//}Erron commented out
	}
}

if(IE || !NS){
    window.onresize=new Function("window.location.reload()");
}
//end of subscription code


//document.all.hpsubscribetab.style.left