function newPopUp(newurl,newname,width,height,scrollbars) {
	
 apopup=window.open(newurl,newname,width,height,scrollbars,'toolbar=no,location=no,directories=no,status=no,resizable=yes,copyhistory=no');

}

/* Script från <www.tamo.se> - Får användas fritt så länge denna rad stå kvar 
Modifierad av David Lidström för Racktech.se*/
function ImageZoom(url, imagewidth, imageheight, pagetitle) {
  extra_width =10; extra_height=40;
  if( navigator.userAgent.indexOf('Opera')!=-1 )
    {extra_width+=10;extra_height+=38;}
  if( navigator.userAgent.indexOf('Gecko')!=-1 )
    {extra_width+=24;extra_height+=65;}
  var Win = window.open('','','width=60,height=60,scrollbars=no,resizable,status=no');
  if( url.title ) pagetitle = url.title;
  with(Win.document)
   {
   open();
    write('<html>');
    if( pagetitle ) write('<head><title>'+pagetitle+'</title>');
    write('<meta http-equiv="imagetoolbar" content="no" /></head>');
    write('<body style="margin:0px;padding:0px 0px 0px 0px;"');
    write(' onload="window.resizeTo(document.images[0].width+'+extra_width+',');
    write('document.images[0].height+'+extra_height+');" >');
    write('<img src="' + url.href + '" />');
    write('</body></html>\n');
    close();
  }
}

function AddToBasket(art_id, title)
{
 alert(art_id);
}

function ImageZoom2(imagepath, imagewidth, imageheight, pagetitle) {

var width = imagewidth + 20;
var height = imageheight+20;

var new_win = window.open(imagepath, 'imagezoom', 'width=' + width + ',height='+height+',toolbar=no,location=no,directories=no,status=no,resizable=yes,copyhistory=no');
if( new_win) return false;
return true;
}

function Tipsa(productID, VendorID, GroupID, SiteRoot) {
 var strQuerystring = new String();
 if( productID ) strQuerystring+=(strQuerystring!=''?'':'') + "product=" + escape(productID);
 if( VendorID ) strQuerystring+=(strQuerystring!=''?'&amp;':'') + "vendor=" + escape(VendorID);
 if( GroupID ) strQuerystring+=(strQuerystring!=''?'&amp;':'') + "groupId=" + escape(GroupID);
 if( strQuerystring!="") strQuerystring = "?" + strQuerystring;

 apopup=window.open(SiteRoot + 'tipmail.php' + strQuerystring,'tipmail','width=590,height=370,toolbar=no,location=no,directories=no,status=no,resizable=yes,copyhistory=no');
	
}
 
 function PrintTipsa(tip_product, tip_vendor, tip_group, root) {
  var strHTML = new String();
  strHTML = '<p class="bottom-nav">';
  strHTML+='<a href="javascript:Tipsa(\'' + tip_product + '\', \'' + tip_vendor + '\',\'' + tip_group + '\',\'' + root + '\' )">Tipsa en vän om denna produkt</a>';
  strHTML+=' | <a href="http://www.racktech.se" target="_top">Tillbaka till startsidan</a> | <a href="javascript:visanyhet();">Prenumerera på nyhetsbrevet!</a></p>';
  document.write(strHTML);
 }
 
 
 window.onload = function(){

  if( document.getElementsByTagName ) {
 		var as = document.getElementsByTagName("A");
 		
		var re = new RegExp(/\.(jpg|gif|png)$/);
		var rei = new RegExp(/i(\d+)x(\d+)/);

 		for(var i=0; i < as.length; i++) {
 			if( !as[i].setAttribute || !as[i].getAttribute ) return false;
 			if( as[i].getAttribute('rel')=='external'){
 				as[i].setAttribute("target", "_blank");
 				if( re.test(as[i]) ){
 					if( rei.test(as[i])){
 						var m = rei.exec(as[i]);
 						w = parseFloat(m[1]);
 						h = parseFloat(m[2]);
 						if( as[i].getAttribute("title")!="") {
 							as[i].setAttribute('imagetitle', as[i].getAttribute("title"));
 						} else {
 							as[i].setAttribute('imagetitle', "Racktech - " + as[i]);
 						}
						as[i].setAttribute('imagewidth', w);
						as[i].setAttribute('imageheight', h);
						as[i].onclick= function(){
 							var w = window.open('about:blank', '', 'width=' + (parseFloat(this.getAttribute('imagewidth'))+8) + ',height=' + (parseFloat(this.getAttribute('imageheight'))+8));
 							if( w == null || typeof(w)=="undefined" ) {
 								document.location.href = this;
 								return true;
 							} else {
	 							w.document.open();
								w.document.write("<html>");
								w.document.write("<head><title>" + this.getAttribute("imagetitle") + "</title></head>");
								w.document.write("<body style='text-align:middle;margin:0px;padding:0px;'>");
								w.document.write("<img src=\"" + this + "\" width=\"" + this.getAttribute('imagewidth') + "\" height=\"" + this.getAttribute('imageheight') + "\">");
								w.document.write("</body>");
								w.document.write("</html>");
	 							w.document.close();
	 							w.focus();
 							}
 							return false;
						}
 					}
 				}
 			}
 		}
  }
 }
 /*
 var alreadyChecked = false;
 function felhantering_redirect(msg,url,line){
  top.location.replace('/?go=' + escape(document.location.href,1));
  alreadyChecked = true;
  return true;
 }
 function felhantering_ignorera(){
 	return false;
 }
 window.onerror = felhantering_ignorera;
 if(document.getElementById ) {doIt();}
 
 
 if( !alreadyChecked ) {
  window.onerror = felhantering_redirect;
  var url = top.document.location;
 }
 window.onerror = null;
 
 if( document.location.href == top.location.href ) {
  if(document.location.href.indexOf('produkter/')!=-1) {
   felhantering_redirect();
  }
 }
 

 function doIt() {
 	var e = "try {\n" + 
   "var url = top.document.location;\n" + 
  "} catch(e) {" + 
	" top.location.replace('/?go=' + escape(document.location.href,1));\n" + 
  "}";
  eval(e);
 }
 */