
function checkForEnter(e){
  e = e ? e:event;
	if(e.keyCode == 13){
    addToCart();
 	}
}



function resize()
{
		top.document.getElementById('iFrameName').height=1100;
		var thisHeight = document.body.scrollHeight+200;
		if (thisHeight>1100)	
			top.document.getElementById('iFrameName').height=thisHeight;

}


function scrollTopFrame(){
	if(event.wheelDelta < 0){
		top.scrollBy(0,100);}
	else{
		top.scrollBy(0,-100);
	}
}

function openNWindow(theURL,winName,features)
	{
		newWin=	window.open(theURL,winName,features, resizeable="yes");
		newWin.moveTo(600,250);
		newWin.resizeBy(20, 30);
		newWin.focus();
	}

function checkForFrameset(newURL){
	if(window.parent.length<2){ // Not in a framset
		top.location="http://www.optisound.se/"+newURL;
	}
}


function getScrollXY() {
  var scrOfX = 0, scrOfY = 0;
  if( typeof( window.pageYOffset ) == 'number' ) { //Netscape
    scrOfY = window.pageYOffset;
    scrOfX = window.pageXOffset;
  } else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) { //DOM
    scrOfY = document.body.scrollTop;
    scrOfX = document.body.scrollLeft;
  } else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {//IE6
    scrOfY = document.documentElement.scrollTop;
    scrOfX = document.documentElement.scrollLeft;
  }
  return [ scrOfX, scrOfY ];
}



function showImg(url){
	var im = $('imgid');
//	var parent = im.parentNode;
//	parent.removeChild(im);
//	var newImg =  document.createElement("img");
//	newImg.border=3;
//	newImg.name="myimgname";
//	newImg.id="imgid";
//	newImg.src=url;
//	newImg.style="cursor:url('grafik/glasminus.cur'), pointer";
//	newImg.onclick="Effect.Shrink('imgid', {direction:'top-left'}); return false;";
//	parent.appendChild(newImg);
	var is_chrome = navigator.userAgent.toLowerCase().indexOf('chrome') > -1;
	if(is_chrome) {
		window.open(url,'_blank','toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=auto,resizable=0'); 
	} else {
		im.style.heigth= '';
		im.src=url;
		var pos = getScrollXY();
		$('mydiv').style.top=pos[1];
		Effect.Grow('imgid', {direction:'top-left'});
	}
}

