function preloadActiveImage(name,src) {
	document.images[name].inactive = new Object;
	document.images[name].inactive.src = document.images[name].src;
	document.images[name].active = new Image;
	document.images[name].active.src = src;
}

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

function find(n,d) {
	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=find(n,d.layers[i].document);
	if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function showLayers() {
  	var i,p,v,obj,args=showLayers.arguments;
  	for (i=0; i<(args.length-2); i+=3) if ((obj=find(args[i]))!=null) { v=args[i+2];
   	if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    	obj.visibility=v; }
}

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

function jumpMenu(targ,selObj,restore){
	eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
	if (restore) selObj.selectedIndex=0;
}

function popUpWindow(URLStr,height,width,toolbar,scrollbars) {
	var popUpWin = 0; var left = 200; var top = 30;

	if(popUpWin) { if (!popUpWin.closed) popUpWin.close(); }
	popUpWin = open(URLStr,'popUpWin','toolbar='+toolbar+',location=no,directories=no,status=no,scrollbars='+scrollbars+',resizable=no,copyhistory=yes,width='+width+',height='+height+',left='+left+', top='+top+',screenX='+left+',screenY='+top+'');
}

function pruef_styletext1() {
	counter_styletext1 = 25;
	var anz = document.textbox.styletext1.value.length;
	if (anz> counter_styletext1) {
	document.textbox.styletext1.value = document.textbox.styletext1.value.substring(0,counter_styletext1);frei = 0;
	} else {
	frei = counter_styletext1-anz;
	}
	document.textbox.count_styletext1.value = frei;
}

function pruef_styletext2() {
	counter_styletext2 = 25;
	var anz = document.textbox.styletext2.value.length;
	if (anz> counter_styletext2) {
	document.textbox.styletext2.value = document.textbox.styletext2.value.substring(0,counter_styletext2);frei = 0;
	} else {
	frei = counter_styletext2-anz;
	}
	document.textbox.count_styletext2.value = frei;
}

function check_Fields() {
	var status = 0

	if ((document.textbox.styletext1.value.length=="0") || (document.textbox.styletext1.value=="Bitte um eine Eingabe")) {
	document.textbox.styletext1.style.backgroundColor = "#C5E4EC";
	document.textbox.styletext1.value = "Bitte um eine Eingabe";
	status = 1;
	}

	if (document.textbox.fontselector.value=="0") {
	document.textbox.fontselector.style.backgroundColor = "#C5E4EC";
	status = 1;
	}
	return !status;
}

function setFirst(strField) {
	if (strField!="fontselector") {
	document.textbox[strField].select()
	}
	document.textbox[strField].style.backgroundColor = "#FFFFFF";
}

function fontstatus() {
	var inhalt = document.textbox.fontselector.value;
	swap('fonts','',"/images/font_" + inhalt + ".gif",1)
}


function sizeStatus(inhalt,usersessionID,versendung,gratis) {
	
	
	if (inhalt!="error") {
		popUpWindow("https://ssl11.inode.at/print-house.at/order.php?usersessionID=" + usersessionID + "&versendung=" + versendung + "&gratis=" + gratis + "",'400','600')
	} else {
		alert("Bitte geben Sie eine Grösse an!")
	}
}