/* ©2008 Anthony Pagliaro inc. Coded by Anthony Pagliaro anthony.pagliaro@direktel.com */
function getScrollXY() {
  var scrOfX = 0, scrOfY = 0;
  if( typeof( window.pageYOffset ) == 'number' ) {
	//Netscape compliant
	scrOfY = window.pageYOffset;
	//scrOfX = window.pageXOffset;
  } else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {
	//DOM compliant
	scrOfY = document.body.scrollTop;
	//scrOfX = document.body.scrollLeft;
  } else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {
	//IE6 standards compliant mode
	scrOfY = document.documentElement.scrollTop;
	//scrOfX = document.documentElement.scrollLeft;
  }
  return scrOfY;
}	
function buyNowY () {
	var buynow = document.getElementById('buynowTab');
	var scroller = getScrollXY();
	if (scroller <= 408) {
		buynow.style.top = 418+'px';
	} else {
		buynow.style.top = (scroller+10)+'px';
	}

}
function menu(clickedWhat){ 
	for (var x = 1; x <= 5; x++){
		var temp = document.getElementById('page'+x);
		temp.style.display = 'none';
		removeClass(document.getElementById('menu'+x), "active");					
	}
	var selected = document.getElementById('page'+clickedWhat);
	selected.style.display = 'block';
	addClass(document.getElementById('menu'+clickedWhat), "active");	
	//window.scroll(0,0);Uncomment if you want the page it jump to the top on menu click
}
function addClass(ele,cls) {
	if (!this.hasClass(ele,cls)) ele.className += " "+cls;
}
function removeClass (ele,cls) {
	var startLocation = ele.className.indexOf(cls);
	var collector = ele.className.substring(0,startLocation);
	var collector2 = ele.className.substring(startLocation+cls.length,ele.className.length+1);
	ele.className = (collector+collector2);
}
function hasClass(ele,cls) {
	return ele.className.match(new RegExp('(\\s|^)'+cls+'(\\s|$)'));
}
function validate_email(value)
{
	apos=value.indexOf("@");
	dotpos=value.lastIndexOf(".");
	if (apos<1||dotpos-apos<2) {
		return true;
	}
	return false;
}
function checkfields () {
	if (document.tellafriend.name.value.length==0) {
		alert("please enter your name");
		return false;
	} else if (validate_email(document.tellafriend.email.value)) {
		alert("please a valie email");
		return false;
	} else if (document.tellafriend.friendname1.value.length==0) {
		alert("please enter your friends name");
		return false;
	} else if (validate_email(document.tellafriend.friendmail1.value)) {
		alert("please a valie email");
		return false;
	}
	return true;
}
function setCartUrl() {
	var selector=document.getElementById('ColorSelector');
	var cartButton=document.getElementById('cartUrl');
	if(selector.selectedIndex==0) {cartButton.href="http://www.1shoppingcart.com/SecureCart/SecureCart.aspx?mid=2D4D2F1E-056F-4D5A-98D0-4E70A960DBEF&pid=72137370d29a10f3fb78f4cd9a9d1791";}
	else if(selector.selectedIndex==1) {cartButton.href="http://www.1shoppingcart.com/SecureCart/SecureCart.aspx?mid=2D4D2F1E-056F-4D5A-98D0-4E70A960DBEF&pid=89d135c3d6c29d4accf412bb24b35534";}
	else if(selector.selectedIndex==2) {cartButton.href="http://www.1shoppingcart.com/SecureCart/SecureCart.aspx?mid=2D4D2F1E-056F-4D5A-98D0-4E70A960DBEF&pid=f775c219c75d32ea92445183a017feba";}
	else if(selector.selectedIndex==3) {cartButton.href="http://www.1shoppingcart.com/SecureCart/SecureCart.aspx?mid=2D4D2F1E-056F-4D5A-98D0-4E70A960DBEF&pid=4fdecf2b165be437b95e597a4b76270c";}

}	
function jumpScroll() {
	var homePage = document.getElementById('page1')
	if (homePage.style.display == 'none') menu('1');
	window.scroll(0,745); // horizontal and vertical scroll targets
}			
function jumpScroll_testamonials() {
	menu('3');
	window.scroll(0,418); // horizontal and vertical scroll targets
}	
