// JavaScript Document


function redirectPage ( loc ){

	document.location = loc;
}

function setCheck ( itemName  ){	
	document.getElementById(itemName).checked = "checked";
}


function copyBilling2Shipping(){

	document.getElementById("t_shi_fname").value = 	document.getElementById("t_bill_fname").value;
	document.getElementById("t_shi_lname").value = 	document.getElementById("t_bill_lname").value;
	document.getElementById("t_shi_addr1").value = 	document.getElementById("t_bill_addr1").value;
	document.getElementById("t_shi_addr2").value = 	document.getElementById("t_bill_addr2").value;
	document.getElementById("t_shi_city").value = 	document.getElementById("t_bill_city").value;
	document.getElementById("t_shi_state").value = 	document.getElementById("t_bill_state").value;
	document.getElementById("t_shi_zip").value = 	document.getElementById("t_bill_zip").value;

}

function showID ( idname, stat , memberVal , numposts ){

	if (memberVal > 0 && numposts < 2){
		id_obj = document.getElementById ( idname );
		id_obj.style.display = stat;
	}else{
		if (numposts >= 2){
			alert ("Payed members only. Only 2 free messages per month");
		}else {
			alert ("Must be a member to send a message");
		}
	}
}

function getWindowH(){
	if (parseInt(navigator.appVersion)>3) {
	 if (navigator.appName=="Netscape") {
	  winW = window.innerWidth-16;
	  winH = window.innerHeight-16;
	 }
	 if (navigator.appName.indexOf("Microsoft")!=-1) {
	  winW = document.body.offsetWidth-20;
	  winH = document.body.offsetHeight-20;
	 }
	}
	
	return winH;	
}

function getWindowW(){
	if (parseInt(navigator.appVersion)>3) {
	 if (navigator.appName=="Netscape") {
	  winW = window.innerWidth-16;
	  winH = window.innerHeight-16;
	 }
	 if (navigator.appName.indexOf("Microsoft")!=-1) {
	  winW = document.body.offsetWidth-20;
	  winH = document.body.offsetHeight-20;
	 }
	}
	
	return winW;
}


function showhidewindow ( idname ){

	val = document.getElementById( idname ).style.display;
	
	if (val == "none")
		document.getElementById( idname ).style.display = "";
	else
		document.getElementById( idname ).style.display = "none";
	
}


var newwindow = '';
function popUp(URL,width,height) {
//	day = new Date();
	id = "mywindow";//day.getTime();

	if (!newwindow.closed && newwindow != ''){
	
		newwindow.focus();
		newwindow.location = URL;
//		newwindow.document.width = width;
//		newwindow.document.height = height;
		newwindow.resizeTo( width + 30, height + 50 );
	
	//	alert( width + " , " + height );
		
	}else {
		newwindow = window.open(URL, id, "toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=" + width + ",height="+ height +",left = 50,top = 50");
	}	
}	


temp = true;

function confirmSubmit ( )
{
	valid = temp;
	temp = true; // reset form status
	return valid;
}

function confirmLink (msg,urllink){

	
	var sure = confirm(msg);
	if (sure == true)	
		window.location = urllink;

}


var IE = document.all?true:false

if (!IE) document.captureEvents(Event.MOUSEMOVE)

document.onmousemove = getMouseXY;

var tempX = 0
var tempY = 0
var popUpOpen = false

  
function getMouseXY(e) {
	
	
  if (IE) { // grab the x-y pos.s if browser is IE

 	var myregex = /MSIE 7\.0/i;
    var myArray = navigator.appVersion.match(myregex);
    if(myArray.length > 0){
		tempX = event.clientX + document.body.scrollLeft
		tempY = event.clientY + document.body.scrollTop	
		
	}else{
		tempX = event.clientX + document.documentElement.scrollLeft
		tempY = event.clientY + document.documentElement.scrollTop

	}
  
  
  } else {  // grab the x-y pos.s if browser is NS
    tempX = e.pageX
    tempY = e.pageY
  }  
  // catch possible negative values in NS4
  if (tempX < 0){tempX = 0}
  if (tempY < 0){tempY = 0}  
  // show the position values in the form named Show
  // in the text fields named MouseX and MouseY
  
/*
	obj_info = document.getElementById("info")
	obj_info.style.top = (tempY ) + "px";
	obj_info.style.left = (tempX ) + "px";
*/	

  return true

}	
function setTellAFriendPos(){
	obj_info = document.getElementById("tell_a_friend_form");
	pageHeight = document.getElementById('marker').offsetTop; 
	pageHeight -= 350;
	pageHeight += 'px';
	obj_info.style.top = pageHeight
}

function showTellAFriend(){
	
	setTellAFriendPos();
	showhidewindow ("tell_a_friend_form");

}

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_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_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];}
}