
/// Aktionen die beim Start automatisch ausgeführt werden
$().ready(function() {

	// Input Labels
	$("label.overlabel").overlabel();

	// Navigation Hover
	$("ul#d7_prod_content_navi li").hover(function() {
		$(this).addClass('d7_prod_content_navi_hover');
	},
	function(){
		$(this).removeClass('d7_prod_content_navi_hover');
	});

	$("ul.d7_head_navi20 li").hover(function() {
		$(this).addClass('d7_head_navi20_hover');
	},
	function(){
		$(this).removeClass('d7_head_navi20_hover');
	});


});


//////////////////////////////////////////////////
// Funktionen

function navihide(nid) {

	var objre = document.getElementById("nav"+nid) ;
	objre.style.visibility = "hidden" ;
}


function naviset(nid) {

	var objre = document.getElementById("nav"+nid) ;
	objre.style.visibility = "visible" ;
}

function orderset(nid,cbox) {

	var objre = document.getElementById(nid) ;

	if ( cbox.checked ) {
		objre.style.display = "block" ;
	} else {
		objre.style.display = "none" ;
	}
}

function wopen(link,wi,he) {

	var width=wi; var height=he;
	var l=(screen.availWidth-width)/2;
	var t=(screen.availHeight-height)/2;
    wincom=window.open(link ,"oswin","toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=0,width="+wi+",height="+he+",screenX="+l+",screenY="+t+",left="+l+",top="+t);

    if (wincom) {
    	wincom.focus() ;
	} else {
		alert(statustext) ;
	}
}


function dellink(link,btext) {

	Check = confirm(btext);

	if(Check == false) {
		return ;
	} else {
		window.open(link,'_self') ;
	}
}


function changebutton(s) {

    window.Bestellung.obutton.value = "Bitte warten ... und diesen Button nur 1x klicken !!!!";

    if (SEND==1) {

    	alert("Sie haben die Bestellung bereits abgeschickt, bitte warten Sie auf Antwort des Shop-Servers !") ;
    	return false ;

    } else {

    	SEND=1 ;
    	return true ;
    }
}


function fielddel(f) {

	if (f.value == f.defaultValue) {

		f.value = "" ;
	}
}


function fieldset(f) {

	if (f.value == "") {

		f.value = f.defaultValue ;
	}
}


function fieldemp(f) {

	if (f.sbeg.value == f.sbeg.defaultValue) {

		f.sbeg.value = "" ;
	}
}


function tabbgcolor(tabid,hrefid){

	tabid.className  = 'os_head_navi21_active' ;
	hrefid.className = 'os_head_navi2_active' ;
}


function scart_amount_change(scprice,ssuffix){

	var newprice = scprice - 0 ;

	for ( i=0 ; i < document.forms['os_detail_view'].elements.length ; i++ ) {

		var fname = document.forms['os_detail_view'].elements[i].name ;
		var fvalu = document.forms['os_detail_view'].elements[i].value ;

		if ( fname.match(/^dd/) ) {

			var fvar = new Array() ;

			if ( fname == 'dd' ) {

				fvar = fvalu.split(",") ;

				if ( fvar[1]>0 ) {

					newprice = newprice - scprice ;
				}

			} else {

				fvar = fvalu.split(";") ;
			}

			var addprice = fvar[1] - 0 ;

			if (addprice>0) {

				newprice = newprice + addprice - 0 ;
			}
		}
	}

	newprice = scart_amount_round(newprice) ;
	document.forms['os_detail_view'].tmpsum.value = newprice + " " + ssuffix ;
}


function scart_amount_round(x) {

  	var k = (Math.round(x * 100) / 100).toString();
  	k += (k.indexOf('.') == -1)? '.00' : '00';
  	var t = k.substring(0, k.indexOf('.') + 3);
	return t ;
}

