function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

var bildID="";
var bildPOS="";

function swap_i(name, to, id) {
     bildID=id;            
     document.images[name].src = to;   
	 return org_bild=id;
}

function swap_image(name, to, id, pos) {
     bildID=id;
     bildPOS=pos;            
     document.images[name].src = to;   
	 return org_bild=id;
}
function PictureOpen2(width,height,objectid,id, pos){
if (bildID!="") id=bildID;
if (bildPOS!="") pos=bildPOS;
ziel="/cowboystiefel-shop/popup.php?article="+objectid+"&id="+id+"&pos="+pos+"#p"+pos+"";
PopUp(width,height,ziel)
}
function PictureOpen3(width,height,pfad,objectid,id, pos){
if (bildID!="") id=bildID;
if (bildPOS!="") pos=bildPOS;
ziel=""+pfad+"?article="+objectid+"&id="+id+"&pos="+pos+"#p"+pos+"";
PopUp(width,height,ziel)
}

function PictureOpen(Datei){
if (bildID!="") Datei=bildID;
Bild1= new Image();
Bild1.src=(Datei);
Control(Datei);
}
function Control(Datei){
if((Bild1.width!=0)&&(Bild1.height!=0)){
Anzeige2(Datei);
}
else{
funzione="Control('"+Datei+"')";
intervallo=setTimeout(funzione,20);
}
}

function Anzeige(Datei){

xsize=Bild1.width+50; // Rand zum Fensterabstand horizintal
ysize=Bild1.height+65; // Rand zum Fenster vertikal


ScreenWidth = screen.width; // Bildschirmeinstellung auslesen
ScreenHeight = screen.height; //Bildschrimeinstellung auslesen

xpos = (ScreenWidth/2)-(xsize/2); // Position des Fensters horizontal
ypos = (ScreenHeight/2)-(ysize/2); // Position des Fensters vertikal

if (ysize>ScreenHeight) ysize=(ScreenHeight-100); // Wenn Bild grösser als Bildschrimeinstellung


string="width="+xsize+",height="+ysize+",left="+xpos+",top=5,scrollbars=1,resizable=0,location=0,directories=0,status=0,menubar=0,toolbar=0";

NewWindow=window.open("BILDANSICHT","Datei",string);
NewWindow.document.write ("<html><head><title>BILDANSICHT</title></head>");
NewWindow.document.write ("<body topmargin=0 leftmargin=0 onload=focus()>"); 
NewWindow.document.write ("<form><table align=center cellspacing='0' cellpadding='0' border='0' bordercolor='#FFFFFF' style='border-collapse: collapse'><tr>");
NewWindow.document.write ("<td align='center' valign='top' bgcolor='#FFFFFF'>");
NewWindow.document.write ("<table border='0' cellpadding='0' cellspacing='0' style='background-image: url(");
NewWindow.document.write (Datei);
NewWindow.document.write (")' width='");
NewWindow.document.write (Bild1.width);
NewWindow.document.write ("' height='");
NewWindow.document.write (Bild1.height);
NewWindow.document.write ("'>");
NewWindow.document.write ("<tr>");
NewWindow.document.write ("<td width='100%' align='right' valign='bottom'><b><font face='Verdana' size='2'color='#C0C0C0'>");
NewWindow.document.write ("&nbsp;&nbsp;</font></b></td>");
NewWindow.document.write ("</tr></table>");
NewWindow.document.write ("</td></tr>");
NewWindow.document.write ("</tr></table></form>");
NewWindow.document.write ("</body></html>");
NewWindow.document.close();
NewWindow.resizeTo(xsize,ysize); 
return false;
}

function Anzeige2(Datei){

xsize=Bild1.width+50; // Rand zum Fensterabstand horizintal
ysize=Bild1.height+85; // Rand zum Fenster vertikal


ScreenWidth = screen.width; // Bildschirmeinstellung auslesen
ScreenHeight = screen.height; //Bildschrimeinstellung auslesen

xpos = (ScreenWidth/2)-(xsize/2); // Position des Fensters horizontal
ypos = (ScreenHeight/2)-(ysize/2); // Position des Fensters vertikal

if (ysize>ScreenHeight) ysize=(ScreenHeight-100); // Wenn Bild grösser als Bildschrimeinstellung


string="width="+xsize+",height="+ysize+",left="+xpos+",top=5,scrollbars=1,resizable=0,location=0,directories=0,status=0,menubar=0,toolbar=0";

NewWindow=window.open("BILDANSICHT","Datei",string);
NewWindow.document.write ("<html><head><title>BILDANSICHT</title></head>");
NewWindow.document.write ("<body topmargin=0 leftmargin=0 onload=focus()>"); 
NewWindow.document.write ("<table width='100%' border='0' cellpadding='0' cellspacing='0' height='100%'>");
NewWindow.document.write ("<tr>");
NewWindow.document.write ("<td align='center' valign='middle'><a href='javascript:self.close()'><img src='");
NewWindow.document.write (Datei);
NewWindow.document.write ("' border='0'></a>");
NewWindow.document.write ("</td>");
NewWindow.document.write ("</tr></table>");
NewWindow.document.write ("</body></html>");
NewWindow.document.close();
NewWindow.resizeTo(xsize,ysize); 
return false;
}

function show_div(id) {
    document.getElementById(id).style.display="block";
}
function hide_div(id) {
    document.getElementById(id).style.display="none";
    document.forms["form1"].elements["Bezahlung_Kontoinhaber"].value = "";
    document.forms["form1"].elements["Bezahlung_BLZ"].value = "";
    document.forms["form1"].elements["Bezahlung_Kontonummer"].value = "";
    document.forms["form1"].elements["Bezahlung_Bank"].value = "";
}
function show_hide_adress() {
   if (document.forms["adresse"].alternative.checked==true) {
        document.getElementById('adress').style.display="block";
    } else {
        document.getElementById('adress').style.display="none";
        document.forms["adresse"].elements["we_sscf[Alternativ_Vorname]"].value = "";
        document.forms["adresse"].elements["we_sscf[Alternativ_Name]"].value = "";
        document.forms["adresse"].elements["we_sscf[Alternativ_Firma]"].value = "";
        document.forms["adresse"].elements["we_sscf[Alternativ_Strasse]"].value = "";
        document.forms["adresse"].elements["we_sscf[Alternativ_PLZ]"].value = "";
        document.forms["adresse"].elements["we_sscf[Alternativ_Ort]"].value = "";
    }
}

function PopUp(w,h,ziel) {
  h = h - 20; var x=0, y=0, parameter="";
  if (w < screen.availWidth || h < screen.availHeight) {
    x = (screen.availWidth - w - 12) / 2;
    y = (screen.availHeight - h - 10) / 2;
    if (window.opera) y = 0; // Opera positioniert unter den Symbolleisten
    if (x<0 || y<0) { x=0; y=0; }
    else parameter = "width=" + w + ",height=" + h + ",";
  }
  parameter += "left=" + x + ",top=" + y;
  parameter += ",menubar=no,location=no,toolbar=no,status=no";
  parameter += ",resizable=yes,scrollbars=yes";
  var timestamp = new Date();
  var Fenster = window.open(ziel,timestamp.getTime(),parameter);
  if (Fenster) Fenster.focus();
  return !Fenster;
}
function openNewWindow(URLtoOpen, windowName, windowFeatures) { 
  newWindow=window.open(URLtoOpen, windowName, windowFeatures);
}
function TargetPopUp(w,h,ziel) {
  h = h - 20; var x=0, y=0, parameter="";
  if (w < screen.availWidth || h < screen.availHeight) {
    x = (screen.availWidth - w - 12) / 2;
    y = (screen.availHeight - h - 104) / 2;
    if (window.opera) y = 0; // Opera positioniert unter den Symbolleisten
    if (x<0 || y<0) { x=0; y=0; }
    else parameter = "width=" + w + ",height=" + h + ",";
  }
  parameter += "left=" + x + ",top=" + y;
  parameter += ",menubar=no,location=no,toolbar=no,status=no";
  parameter += ",resizable=yes,scrollbars=yes";
  var timestamp = new Date();
  var Fenster = window.open(ziel,timestamp.getTime(),parameter);
  if (Fenster) Fenster.focus();
  return !Fenster;
}

function nurZahlen(el)
{
  var val = el.value.replace(/[^\^\d]/g, '');
  el.value = val;
}

function einblenden(div) {
  with(document.getElementById(div).style){
    if(display=="none"){
      display="block";
	}
  }
}
function EmailPopUp(w,h,ziel) {
var email=document.getElementById("Username").value;
var val=ziel+"?mail="+email;
var ziel=val;
  h = h - 20; var x=0, y=0, parameter="";
  if (w < screen.availWidth || h < screen.availHeight) {
    x = (screen.availWidth - w - 12) / 2;
    y = (screen.availHeight - h - 104) / 2;
    if (window.opera) y = 0; // Opera positioniert unter den Symbolleisten
    if (x<0 || y<0) { x=0; y=0; }
    else parameter = "width=" + w + ",height=" + h + ",";
  }
  parameter += "left=" + x + ",top=" + y;
  parameter += ",menubar=no,location=no,toolbar=no,status=no";
  parameter += ",resizable=no,scrollbars=no";
  var Fenster = window.open(ziel,"PopUp",parameter);
  if (Fenster) Fenster.focus();
  return !Fenster;
}

function updateprice(el)
{
var val=el.value.replace(/[^\.^,\d]/g, '');
  el.value = val;

// document.getElementById('span_price').innerHTML="<strong>€ "+el.value+"</strong>";
document.getElementById('price').value=el.value;
}

