function newImage(arg) {
	if (document.images) {
		rslt = new Image();
		rslt.src = arg;
		return rslt;
	}
}

	
function changeImages() {
	d = document;
	if (d.images) {
		var img;
		for (var i=0; i<changeImages.arguments.length; i+=2) {
			img = null;
			if (d.layers) {img = findElement(changeImages.arguments[i],0);}
			else {img = d.images[changeImages.arguments[i]];}
			if (img) {img.src = changeImages.arguments[i+1];}
		}
	}
}

var preloadFlag = false;
function preloadImages() {
	if (document.images) {
	//	over_home_off = newImage('img/allgemein/home_on.gif');
	//	over_kontakt_off = newImage('img/allgemein/kontakt_on.gif');
	//	over_nav_zertifizierungen_off = newImage('img/allgemein/nav_zertifizierungen_on.gif');
	//	over_nav_pruefinstitute_off = newImage('img/allgemein/nav_pruefinstitute_on.gif');
	//	over_nav_organisation_off = newImage('img/allgemein/nav_organisation_on.gif');
	//	over_nav_service_off = newImage('img/allgemein/nav_service_on.gif');
	//	over_deutsch_on = newImage('img/start/deutsch_on.gif');
	//	over_englisch_on = newImage('img/start/englisch_on.gif');
	//	over_franzoesich_on = newImage('img/start/franzoesisch_on.gif');
		preloadFlag = true;
	}
}


function set_checkbox(formname){
/*aktiviert oder deaktivert die Checkbox im Formular audit_zulieferer_neu.php oder audit_zulieferer_bearb.php*/
	if (document.forms[formname].FLD_OFFICE.value != 0){
		document.forms[formname].CHK_LOGIN.disabled = false;
	}else{
		document.forms[formname].CHK_LOGIN.disabled = true;
	}

}

function check_checkbox(formname){
/*entfernt die E-Mailadresse des Ansprechpartners wenn checkbox deaktivier, im Formular audit_zulieferer_neu.php oder audit_zulieferer_bearb.php*/
	if (!document.forms[formname].CHK_LOGIN.checked && document.forms[formname].FLD_COREFID.value != 0){
		document.forms[formname].FLD_C_EMAIL.value = "";
		document.forms[formname].FLD_C_EMAIL.disabled = true;
	}else{
		document.forms[formname].FLD_C_EMAIL.disabled = false;
	}

}

function VDS_AGB(){
	if(document.getElementById("FLD_AGB").checked==true){
		document.getElementById("SUB_VDS3").disabled = false;
	}else{
		document.getElementById("SUB_VDS3").disabled = true;
	}
}
function setShippingCountry(){
	try{
		shipping_country = document.forms['FRM_BESTELLEN_1'].FLD_REG_OFFICE_LAND.value;
	}catch(e){
		shipping_country = document.forms['FRM_BESTELLEN_1'].FLD_LAND.value;
	}
	document.getElementsByName("FLD_shipping_country")[0].value = shipping_country;
	handlePayments();
}
function VDS_BILL(field){
	//disable or enable the billing type invoice
	//whenever a regional office or a superuser is the invoice receiver
	
	try{
		country = field.value;
		fieldtype = field.name;
	}catch(e){
		country = document.forms['FRM_BESTELLEN_1'].FLD_LAND.value;
		fieldtype = "FLD_LAND";		
	}
	
	try{
		shipping_country = document.forms['FRM_BESTELLEN_1'].FLD_REG_OFFICE_LAND.value;
	}catch(e){
		shipping_country = document.forms['FRM_BESTELLEN_1'].FLD_LAND.value;
	}
	
	//not available in CMS
	try{
		document.getElementsByName("FLD_shipping_country")[0].value = shipping_country;
	}catch(e){}
	
	//not available in CMS
	try{
		handlePayments();
	}catch(e){}
	
	//not available in CMS	
	try{
		companycheck = document.forms['FRM_BESTELLEN_1'].FLD_BUYER_TYPE[0].checked;		
	}catch(e){
		companycheck = true;
	}

	//Prefill VAT number field with the ISO code
	
	if(country=='GR' && document.forms['FRM_BESTELLEN_1'].FLD_BUYER_TYPE[0].checked == true){
		if(fieldtype == "FLD_LAND")
			document.forms['FRM_BESTELLEN_1'].FLD_VAT.value = "EL";
		else
			document.forms['FRM_BESTELLEN_1'].FLD_REG_OFFICE_VAT.value = "EL";			
	}else if(country !='xxx' && country !='DE' && companycheck == true){
		if(fieldtype == "FLD_LAND")
			document.forms['FRM_BESTELLEN_1'].FLD_VAT.value = country;
		else
			document.forms['FRM_BESTELLEN_1'].FLD_REG_OFFICE_VAT.value = country;
	}else if(country =='xxx' || country =='DE' || companycheck == false){
		if(fieldtype == "FLD_LAND")
			document.forms['FRM_BESTELLEN_1'].FLD_VAT.value = '';
		else
			document.forms['FRM_BESTELLEN_1'].FLD_REG_OFFICE_VAT.value = '';		
	}

}



function noteconfirm(urls, all){
	if (all==0)
	{
		really = confirm("<?=$lang_err_add_audit?>");
	}
	else if (all==1){ really = confirm("<?=$lang_err_del_audit?>");
	}
	else if (all==2){ really = confirm("<?=$lang_err_lock?>");
	}
	else if (all==3){ really = confirm("<?=$lang_err_lock2?>");
	}
	else if (all==4){ really = confirm("<?=$lang_err_del_user?>");
	}
	else if (all==5){ really = confirm("<?=$lang_deleteentry?>");
	}
	else if (all==6){ really = confirm("<?=$lang_deleteaccount?>");
	}
	else if (all==7){ really = confirm("<?=$lang_deleteentry?>");
	}
	if (really==true) document.location.href = urls;
}

function newnoteconfirm(urls, string){
	really = confirm(string);
	if (really==true) document.location.href = urls;
}

function ChangeMenue(myid) {
	document.getElementById(1).style='visibility:hidden;display:none';
}

function printswitch(elementname,elementname1){
	if(document.getElementById(elementname).style.display == 'block'){
		document.getElementById(elementname).style.display='none';
		document.getElementById(elementname1).style.display='block';
	}else{
		document.getElementById(elementname).style.display='block';
		document.getElementById(elementname1).style.display='none';
	}
}

function myTESTFLD_CERTREASON() {
	if(window.document.FRM_CERTREASON.FLD_CERTREASON.value=="") {
		alert("<?=$lang_reasons2?>");
		return false;
	} else {
		return true;
	}
}

/*////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////*/

	/******************************************
	* Popup Box- By Jim Silver @ jimsilver47@yahoo.com
	* Visit http://www.dynamicdrive.com/ for full source code
	* This notice must stay intact for use
	******************************************/

	var ns4=document.layers
	var ie4=document.all
	var ns6=document.getElementById&&!document.all

	//drag drop function for NS 4////
	/////////////////////////////////

	var dragswitch=0
	var nsx
	var nsy
	var nstemp

	function drag_dropns(name){
		if (!ns4)
		return
		temp=eval(name)
		temp.captureEvents(Event.MOUSEDOWN | Event.MOUSEUP)
		temp.onmousedown=gons
		temp.onmousemove=dragns
		temp.onmouseup=stopns
	}

	function gons(e){
		temp.captureEvents(Event.MOUSEMOVE)
		nsx=e.x
		nsy=e.y
	}
	function dragns(e){
		if (dragswitch==1){
			temp.moveBy(e.x-nsx,e.y-nsy)
			return false
		}
	}

	function stopns(){
		temp.releaseEvents(Event.MOUSEMOVE)
	}

	//drag drop function for ie4+ and NS6////
	/////////////////////////////////


	function drag_drop(e){
		if (ie4&&dragapproved){
			crossobj.style.left=tempx+event.clientX-offsetx
			crossobj.style.top=tempy+event.clientY-offsety
			return false
		}
		else if (ns6&&dragapproved){
			crossobj.style.left=tempx+e.clientX-offsetx+"px"
			crossobj.style.top=tempy+e.clientY-offsety+"px"
			return false
		}
	}



	function initializedrag(e){
		crossobj = ns6? document.getElementById("showimage") : document.all.showimage
		var firedobj = ns6? e.target : event.srcElement
		var topelement=ns6? "html" : document.compatMode && document.compatMode!="BackCompat"? "documentElement" : "body"

		while (firedobj.tagName!=topelement.toUpperCase() && firedobj.id!="dragbar"){
		firedobj=ns6? firedobj.parentNode : firedobj.parentElement
	}

	if (firedobj.id=="dragbar"){
		offsetx=ie4? event.clientX : e.clientX
		offsety=ie4? event.clientY : e.clientY

		tempx=parseInt(crossobj.style.left)
		tempy=parseInt(crossobj.style.top)

		dragapproved=true
		document.onmousemove=drag_drop
		}
	}
	document.onmouseup=new Function("dragapproved=false")

	////drag drop functions end here//////

	function hidebox(){
		crossobj=ns6? document.getElementById("showimage") : document.all.showimage
		if (ie4||ns6)
			crossobj.style.visibility="hidden"
			else if (ns4)
			document.showimage.visibility="hide"
	}

	function showbox(){
		crossobj=ns6? document.getElementById("showimage") : document.all.showimage
		if (ie4||ns6)
			crossobj.style.visibility="visible"
			else if (ns4)
			document.showimage.visibility="show"
	}



// xp_progressbar
// Copyright 2004 Brian Gosselin of ScriptAsylum.com
//
// v1.0 - Initial release
// v1.1 - Added ability to pause the scrolling action (requires you to assign
//        the bar to a unique arbitrary variable).
//      - Added ability to specify an action to perform after a x amount of
//      - bar scrolls. This requires two added arguments.
// v1.2 - Added ability to hide/show each bar (requires you to assign the bar
//        to a unique arbitrary variable).

// var xyz = createBar(
// total_width,
// total_height,
// background_color,
// border_width,
// border_color,
// block_color,
// scroll_speed,
// block_count,
// scroll_count,
// action_to_perform_after_scrolled_n_times
// )

var w3c=(document.getElementById)?true:false;
var ie=(document.all)?true:false;
var N=-1;

function createBar(w,h,bgc,brdW,brdC,blkC,speed,blocks,count,action){
if(ie||w3c){
var t='<div id="_xpbar'+(++N)+'" style="visibility:visible; position:relative; overflow:hidden; width:'+w+'px; height:'+h+'px; background-color:'+bgc+'; border-color:'+brdC+'; border-width:'+brdW+'px; border-style:solid; font-size:1px;">';
t+='<span id="blocks'+N+'" style="left:-'+(h*2+1)+'px; position:absolute; font-size:1px">';
for(i=0;i<blocks;i++){
t+='<span style="background-color:'+blkC+'; left:-'+((h*i)+i)+'px; font-size:1px; position:absolute; width:'+h+'px; height:'+h+'px; '
t+=(ie)?'filter:alpha(opacity='+(100-i*(100/blocks))+')':'-Moz-opacity:'+((100-i*(100/blocks))/100);
t+='"></span>';
}
t+='</span></div>';
document.write(t);
var bA=(ie)?document.all['blocks'+N]:document.getElementById('blocks'+N);
bA.bar=(ie)?document.all['_xpbar'+N]:document.getElementById('_xpbar'+N);
bA.blocks=blocks;
bA.N=N;
bA.w=w;
bA.h=h;
bA.speed=speed;
bA.ctr=0;
bA.count=count;
bA.action=action;
bA.togglePause=togglePause;
bA.showBar=function(){
this.bar.style.visibility="visible";
}
bA.hideBar=function(){
this.bar.style.visibility="hidden";
}
bA.tid=setInterval('startBar('+N+')',speed);
return bA;
}}

function startBar(bn){
var t=(ie)?document.all['blocks'+bn]:document.getElementById('blocks'+bn);
if(parseInt(t.style.left)+t.h+1-(t.blocks*t.h+t.blocks)>t.w){
t.style.left=-(t.h*2+1)+'px';
t.ctr++;
if(t.ctr>=t.count){
eval(t.action);
t.ctr=0;
}}else t.style.left=(parseInt(t.style.left)+t.h+1)+'px';
}

function togglePause(){
if(this.tid==0){
this.tid=setInterval('startBar('+this.N+')',this.speed);
}else{
clearInterval(this.tid);
this.tid=0;
}}

function togglePause(){
if(this.tid==0){
this.tid=setInterval('startBar('+this.N+')',this.speed);
}else{
clearInterval(this.tid);
this.tid=0;
}}


/*////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////*/