// Sifr
 	if(typeof sIFR == "function"){
		sIFR.replaceElement(named({sSelector:"h1.sifr", sFlashSrc:"http://www.carolinen.de/fileadmin/develop/sifr/tradegothic.swf",sWmode:"transparent", sColor:"#74aede", sLinkColor:"#000000", sHoverColor:"#CCCCCC"}));
		sIFR.replaceElement(named({sSelector:"h1.sifrOrange", sFlashSrc:"http://www.carolinen.de/fileadmin/develop/sifr/tradegothic.swf", sWmode:"transparent", sColor:"#e67e27", sLinkColor:"#000000", sHoverColor:"#CCCCCC"}));
		sIFR.replaceElement(named({sSelector:"h2.sifr", sFlashSrc:"http://www.carolinen.de/fileadmin/develop/sifr/tradegothic.swf", sWmode:"transparent", sColor:"#00386a", sLinkColor:"#000000", sHoverColor:"#CCCCCC"}));
		sIFR.replaceElement(named({sSelector:"h3.sifr", sFlashSrc:"http://www.carolinen.de/fileadmin/develop/sifr/tradegothic.swf", sWmode:"transparent", sColor:"#00386a", sLinkColor:"#000000", sHoverColor:"#CCCCCC"}));
		sIFR.replaceElement(named({sSelector:"h3.sifrOrange", sFlashSrc:"http://www.carolinen.de/fileadmin/develop/sifr/tradegothic.swf", sWmode:"transparent", sColor:"#e67e27", sLinkColor:"#000000", sHoverColor:"#CCCCCC"}));
		sIFR.replaceElement(named({sSelector:"h3.sifrSub", sFlashSrc:"http://www.carolinen.de/fileadmin/develop/sifr/tradegothic.swf", sWmode:"transparent", sColor:"#74aede", sLinkColor:"#000000", sHoverColor:"#CCCCCC"}));
		sIFR.replaceElement(named({sSelector:"p.sifr", sFlashSrc:"http://www.carolinen.de/fileadmin/develop/sifr/tradegothic.swf", sWmode:"transparent", sColor:"#00386a", sLinkColor:"#000000", sHoverColor:"#CCCCCC"}));
		//sIFR.replaceElement(named({sSelector:"span.pdf", sFlashSrc:"sifr/tradegothic.swf", sWmode:"transparent", sColor:"#063565", sLinkColor:"#063565", sHoverColor:"#E67E27"}));
		//sIFR.replaceElement(named({sSelector:"span.link", sFlashSrc:"sifr/tradegothic.swf", sWmode:"transparent", sColor:"#063565", sLinkColor:"#063565", sHoverColor:"#E67E27"}));
		//sIFR.replaceElement(named({sSelector:"span.linkInfo", sFlashSrc:"sifr/tradegothic.swf", sWmode:"transparent", sColor:"#e67e27", sLinkColor:"#e67e27", sHoverColor:"#74aede"}));
	}; 
	
// Lightbox
var isProductLightbox = false;
$(function() {
	 $('a[rel*=lightbox], a[rel*=lightbox3]').lightBox({
	imageLoading: 'fileadmin/develop/img/lightbox/loading.gif',
	imageBtnClose: 'fileadmin/develop/img/dialog/btn_close.png',
	imageBtnPrev: 'fileadmin/develop/img/lightbox/lightbox-btn-prev.gif',
	imageBtnNext: 'fileadmin/develop/img/lightbox/lightbox-btn-next.gif',
	imageBlank: 'fileadmin/develop/img/lightbox/lightbox-blank.gif',
	txtImage: 'Bild',
	txtOf: 'von'
	 });
	 
	 // product lightbox
	 var productLightbox = $('a[rel*=lightbox3]');
	 if (productLightbox.length) {
		isProductLightbox = true;
	 }
});

function getLightboxClass() {
	if (isProductLightbox) {
		return ' class="product-info"';
	}
	
	return '';
}

// Lightbox Normal
$(function() {
	 $('a[rel*=lightbox2]').lightBox({
	imageLoading: 'fileadmin/develop/img/lightbox/loading.gif',
	imageBtnClose: 'fileadmin/develop/img/lightbox/closelabel.png',
	imageBtnPrev: 'fileadmin/develop/img/lightbox/lightbox-btn-prev.gif',
	imageBtnNext: 'fileadmin/develop/img/lightbox/lightbox-btn-next.gif',
	imageBlank: 'fileadmin/develop/img/lightbox/lightbox-blank.gif',
	txtImage: 'Bild',
	txtOf: 'von'
	 });
});

// Dialog
$(function() {
	$("#dialog-large, #dialog-product, #dialog-info, #dialog-info1, #dialog-info2, #dialog-info3").dialog({
		autoOpen: false,
		modal: true,
		resizable: false,
		bgiframe: true
	});
	
	$('.col-products-con').append($('#infoButtons').html());
	$('#infoButtons').remove();
	
	$('.openDialogInfo').click(function() {
		if ($('#dialogInfoPopup').length > 0) {
			$('#dialogInfoPopup').remove();
		}
	
		var popupHtml = '<div id="dialogInfoPopup"><div id="jquery-overlay" style="background-color: rgb(0, 0, 0); opacity: 0.8; width: 1263px; height: 879px;"></div> \
			<div class="product-info dialogInfoPopup" id="jquery-lightbox" style="top: 56.5px; left: 0px;"> \
				<div id="lightbox-container-image-box" style="width: 411px; display: block; height: 500px;"> \
					<div id="lightbox-container-image" style="padding-top: 50px;"> '
						 + $(this).parent().find('.dialogInfoContent').html() + ' \
					</div> \
				</div> \
				<div id="lightbox-container-image-data-box" style="display: block; width: 391px;"> \
					<div id="lightbox-container-image-data"> \
						<div id="lightbox-secNav" style="left: 270px !important;"> \
							<a id="lightbox-secNav-btnClose" style="cursor:pointer" onclick="javascript:$(\'#dialogInfoPopup\').remove();"> \
								<img src="fileadmin/develop/img/dialog/btn_close.png"> \
							</a> \
						</div> \
					</div> \
				</div> \
			</div></div>';
		$('body').append(popupHtml);
	});
});

openDialog = (function(d, dWidth, dHeight, noClose) {
	if( noClose == 'close' || noClose == 'closeGreen'){
		dWidth = dWidth +10;
		dHeight = dHeight +15;
	}
	$(d).dialog('option', 'width', dWidth);
	$(d).dialog('option', 'height', dHeight);
	$(d).dialog('option', 'dialogClass', noClose);
	$(d).dialog('open');
	
	// jCarousel innerhalb des Dialogs
	jQuery('#mycarousel_large, #mycarousel_product').jcarousel({
		scroll: 1
	});
	
});
closeDialog = (function(d) {
	$(d).dialog('close');
	cancelSelection();
});


// jCarousel
jQuery(document).ready(function() {
	jQuery('#mycarousel_small').jcarousel({
		scroll: 1		
	});
});

// jCarousel big
jQuery(document).ready(function() {
	jQuery('#mycarousel_big').jcarousel({
		scroll: 3		
	});
});

// Png-Fix
if (typeof DD_belatedPNG != 'undefined') {
	DD_belatedPNG.fix('img, #footer, .boxen div, .item, .step1, .step2, .step3, .special, #container-footer');
	//DD_belatedPNG.fix('img, #footer, .boxen div');
}

// Show & Hide der Formulare
function show(no){
	
	var nummer = no.options[no.selectedIndex].value;
	var count =  no.options.length;
	
	for(i=1;i<count;i++) {
		document.getElementById('div'+i).style.display = 'none';
		
		if( nummer > 0 )
			document.getElementById('div'+nummer).style.display = 'block';
			document.getElementById('div'+nummer).style.height = '400px';
	}
	
	/* FUNKTIONIERT NICHT */
	
	//var nummer = no.value;	
	//var kinder = document.getElementById('parent').childNodes;	
	
	//alle verstecken
	//for( var i=0; i<kinder.length; i++ ){
	//	kinder[i].style.cssText = "display:none";
	//}
		
	//gewünschtes einblenden
	//document.getElementById('div'+nummer).style.cssText = "display:inline; height:100%";
}

// Produkt Random Bildwechsel
function changeImages(param) {
	// imagefolder
	var folder = 'fileadmin/user_upload/produktbilder/'+param+'/';
		
	// random generator
	if( param == 'mineralwasser') {
		var rand = 1 + 3*(Math.random());
		rand = Math.round(rand);
	}
	
	if( param == 'fruchthauch') {
		var rand = 1 + 3*(Math.random());
		rand = Math.round(rand);
	}	
	
	if( param == 'sport_wellness') {
		var rand = 1 + 1*(Math.random());
		rand = Math.round(rand);
	}		
	
	if( param == 'schorlen') {
		var rand = 1 + 1*(Math.random());
		rand = Math.round(rand);
	}	
	
	if( param == 'vitamingetraenke') {
		var rand = 1 + 4*(Math.random());
		rand = Math.round(rand);
	}		
	
	if( param == 'sprudel_brausen') {
		var rand = 1 + 5*(Math.random());
		rand = Math.round(rand);
	}		
	
	// change image source
	if ($('#swapImage').length > 0) {
		$('#swapImage').attr('src', folder+rand+'.png');
	}
}

// Produkt Detail Seite - Dialog Informationslayer ein/ausblenden
function showInfoLayer(param) {
	if(param == 'infoLayer2') {
		document.getElementById('infoLayer1').style.display = 'none';
		document.getElementById(param).style.display = 'inline';
	}
	if(param == 'infoLayer1') {
		document.getElementById('infoLayer2').style.display = 'none';
		document.getElementById(param).style.display = 'inline';
	}	
}

function showPopup(el){
    document.getElementById(el).style.display='block';
}

function hidePopup(el){  
    document.getElementById(el).style.display='none';
    if( document.getElementById('reg_pad') )
        document.getElementById('reg_pad').style.display='none';
    if( currentField != '' )
        document.forms[0].elements[currentField].focus();
}

// Gewinnspiel
function checkFormGewinnspiel(){
	var val_check = true;	
	var error     = '';	
	if(document.getElementById("vorname").value == ''){
		document.getElementById("vorname").style.backgroundColor = "#E67E27";
		val_check = false;
	}
	else{
		document.getElementById("vorname").style.backgroundColor = "#fff";
	}			

	if(document.getElementById("nachname").value == ''){
		document.getElementById("nachname").style.backgroundColor = "#E67E27";
		val_check = false;
	}	
	else{
		document.getElementById("nachname").style.backgroundColor = "#fff";
	}			

	if(document.getElementById("strasse").value == ''){
		document.getElementById("strasse").style.backgroundColor = "#E67E27";
		val_check = false;
	}			
	else{
		document.getElementById("strasse").style.backgroundColor = "#fff";
	}			

	if(document.getElementById("nr").value == ''){
		document.getElementById("nr").style.backgroundColor = "#E67E27";
		val_check = false;
	}	
	else{
		document.getElementById("nr").style.backgroundColor = "#fff";
	}				

	if(document.getElementById("plz").value == ''){
		document.getElementById("plz").style.backgroundColor = "#E67E27";
		val_check = false;
	}	
	else{
		document.getElementById("plz").style.backgroundColor = "#fff";
	}			

	if(document.getElementById("ort").value == ''){
		document.getElementById("ort").style.backgroundColor = "#E67E27";			
		val_check = false;
	}	
	else{
		document.getElementById("ort").style.backgroundColor = "#fff";
	}			

	if(document.getElementById("email").value == ''){
		document.getElementById("email").style.backgroundColor = "#E67E27";						
		val_check = false;
	}	
	else{
		document.getElementById("email").style.backgroundColor = "#fff";
	}			
					
	return val_check;
}
