sfHover = function() {
	var sfEls = document.getElementById("nav").getElementsByTagName("LI");
	for (var i=0; i<sfEls.length; i++) {
		sfEls[i].onmouseover=function() {
			this.className+=" sfhover";
		}
		sfEls[i].onmouseout=function() {
      this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
		}
	}
}
if (window.attachEvent) window.attachEvent("onload", sfHover);

function init() {
  if (getBrowserName() == 'IE' && getBrowserVer() < 7) {
    pngRepair('.png');
  }
};
function getBrowserName() {
    if (navigator.userAgent.indexOf("MSIE")!=-1) return 'IE';
    else if (navigator.userAgent.indexOf("Opera")!=-1) return 'Opera';
    else return 'unknown';
};
function getBrowserVer() {
    var sReturn = 'unknown';
    var sBrowser = getBrowserName();
    if (sBrowser == 'IE') {
        arrRes = navigator.userAgent.match(/MSIE (\d+)/);
        if (arrRes[1]) sReturn = arrRes[1];
    }
    if (sBrowser == 'Opera') {
        arrRes = navigator.userAgent.match(/Opera\/([0-9.]+)/);
        if (arrRes[1]) sReturn = arrRes[1];
    }
    return sReturn;
};

function pngRepair(strTr) {	
  if (navigator.userAgent.indexOf("MSIE")!=-1) {
    for (i=0; i < document.getElementsByTagName("img").length; i++) {
      if (document.getElementsByTagName("img")[i].src.indexOf(".png")!=-1) {
        if (document.getElementsByTagName("img")[i].src.indexOf(strTr) != -1) {
          width = document.getElementsByTagName("img")[i].width;
          height = document.getElementsByTagName("img")[i].height;
          if(document.getElementsByTagName("img")[i].src.indexOf("produkte/img/packs/")!=-1){
            //alert("1wi"+width);
            if(width==137){width=97;height=240;}
            if(width==106){width=66;height=240;}
            //alert("2wi"+width);
          }
          
          src = document.getElementsByTagName("img")[i].src;
          document.getElementsByTagName("img")[i].src='/img/trans.gif';
          document.getElementsByTagName("img")[i].height = height;
          document.getElementsByTagName("img")[i].width = width;
          document.getElementsByTagName("img")[i].style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+src+"',sizingMethod='scale');";
        }
      }
    }
  }
};

function pngRepairCrop(strTr) {	
	  if (navigator.userAgent.indexOf("MSIE")!=-1) {
	    for (i=0; i < document.getElementsByTagName("img").length; i++) {
	      if (document.getElementsByTagName("img")[i].src.indexOf(".png")!=-1) {
	        if (document.getElementsByTagName("img")[i].src.indexOf(strTr) != -1) {
	          width = document.getElementsByTagName("img")[i].width;
	          height = document.getElementsByTagName("img")[i].height;
	          if(document.getElementsByTagName("img")[i].src.indexOf("produkte/img/packs/")!=-1){
	            //alert("1wi"+width);
	            if(width==137){width=97;height=240;}
	            if(width==106){width=66;height=240;}
	            //alert("2wi"+width);
	          }
	          
	          src = document.getElementsByTagName("img")[i].src;
	          document.getElementsByTagName("img")[i].src='/img/trans.gif';
	          document.getElementsByTagName("img")[i].height = height;
	          document.getElementsByTagName("img")[i].width = width;
	          document.getElementsByTagName("img")[i].style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+src+"',sizingMethod='crop');";
	        }
	      }
	    }
	  }
	};

function layerProduct(){
  
}

function printThisSite(){
  $('.image-anwendung').css("filter","");
  var imagecount = $('.image-anwendung').length;
  for(var i=0;i<imagecount;i++){
    var alt = $('.image-anwendung')[i].alt;
    $('.image-anwendung')[i].src =  "http://"+location.host+"/produkte/"+alt;            
  }
  window.print();
  window.setTimeout("uploadAnwendungDocument()", 3000); 
}

function uploadAnwendungDocument(){
  window.location.reload();
}
  
function dragablePopup(idname){
  jQuery('#'+idname).show();
  jQuery('#'+idname).draggable();
  if (getBrowserName() == 'IE' && getBrowserVer() < 7) {
    pngRepair('.png');
  }
}
function closePopup(idname){
  jQuery('#'+idname).hide();
}
