function dis(a){
	a.disabled = "disabled";
	return true;
}

function handleClick(whichClick, whichLayer) {
	
	try {
		var tttt = document.getElementById(whichLayer).value;

		if (whichClick == "hide it")
			hideLayer(whichLayer);
		else if (whichClick == "show it")
			showLayer(whichLayer);
	} catch(e) {
		alert("not existed DIV [" + whichLayer + "]");
	}
	
}

function hideLayer(whichLayer) {
	if (document.getElementById) {
		// this is the way the standards work
		document.getElementById(whichLayer).style.display= "none";
	}
	else if (document.all) {
		// this is the way old msie versions work
		document.all[whichlayer].style.display= "none";
	}
	else if (document.layers) {
		// this is the way nn4 works
		document.layers[whichLayer].display= "none";
	}
}

function showLayer(whichLayer) {
	if (document.getElementById) {
		// this is the way the standards work
		document.getElementById(whichLayer).style.display = "block";
	}
	else if (document.all) {
		// this is the way old msie versions work
		document.all[whichlayer].style.display= "block";
	}
	else if (document.layers) {
		// this is the way nn4 works
		document.layers[whichLayer].display= "block";
	}
}

function calcCartTotal(prodid) {
	if (prodid) {
		handleClick('hide it','qtynotenough'+prodid);
	}
	document.getElementById('totalcart').value = 0;
	for(i=0; i<document.shoppingcartcontents.elements.length; i++) {
		if (document.shoppingcartcontents.elements[i].name.substring(0,9) == "itemtotal") {
			document.getElementById('totalcart').value = parseFloat(document.getElementById('totalcart').value) + parseFloat(document.shoppingcartcontents.elements[i].value);
		}
	}
	document.getElementById('totalcart').value = myRound(document.getElementById('totalcart').value);
}

function myRound(num) {
	return Math.round(num * 100) / 100;
}


function getScreenSize() {
  var myWidth = 0, myHeight = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myWidth = window.innerWidth;
    myHeight = window.innerHeight;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    myWidth = document.documentElement.clientWidth;
    myHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    myWidth = document.body.clientWidth;
    myHeight = document.body.clientHeight;
  }
 
 return [ myWidth, myHeight ];
}
 
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 [ scrOfX, scrOfY ];
 
}
 

