
/* load begin */

var checkedWord = '';

$(document).ready(function() { 
	        $('ul.sf-menu').superfish({ 
	            delay:       1000,
	            animation:   {opacity:'show'}, 
	            speed:       'fast',
	            autoArrows:  false, 
	            dropShadows: false
	        }); 
	        
	       // $(document).pngFix();
	       
	       $('input[name|=formtype_mail]').css("width", "auto");

	        $("a[rel=images_group]").fancybox({
						'transitionIn'		: 'none',
						'transitionOut'		: 'none',
						'titlePosition' 	: 'over'
						
					});
					
				$('#ContactPersonInfo').click(function() {
					if($('#ContactInfo').css("display")!='none'){
						$('#ContactInfo').slideUp('slow', function() {
							$('#ContactPersonInfoCC').html = '+';
						});
					}else{
						$('#ContactInfo').slideDown('slow', function() {
							$('#ContactPersonInfoCC').html = '-';
						});
					}
				}); 
				
				$('#MoreInfo').click(function() {
					if($('#MoreInfoLay').css("display")!='none'){
						$('#MoreInfoLay').slideUp('slow', function() {
							$('#MoreInfoCC').html = '+';
						});
					}else{
						$('#MoreInfoLay').slideDown('slow', function() {
							$('#MoreInfoCC').html = '-';
						});
					}
				});
				
				$('#CompanyFormTitle').click(function() {
					if($('#CompanyForm').css("display")!='none'){
						$('#CompanyForm').slideUp('slow', function() {
							$('#CompanyFormTitleCC').html = '+';
						});
					}else{
						$('#CompanyForm').slideDown('slow', function() {
							$('#CompanyFormTitleCC').html = '-';
						});
					}
				});
				
				$('a.detail_product').click(function(){
					$('#detail_product').show();
					$('#detail_profil').hide();
					$('#detail_contact').hide();
					$('#detail_other_products').hide();
				});
				
				$('a.detail_profil').click(function(){
					$('#detail_profil').show();
					$('#detail_product').hide();
					$('#detail_contact').hide();
					$('#detail_other_products').hide();
				});
				
				$('a.detail_contact').click(function(){
					$('#detail_contact').show();
					$('#detail_product').hide();
					$('#detail_profil').hide();
					$('#detail_other_products').hide();
				});
				
				$('a.detail_other_products').click(function(){
					$('#detail_other_products').show();
					$('#detail_product').hide();
					$('#detail_profil').hide();
					$('#detail_contact').hide();
				});
				
				$('.box1 h3').click(function(){
					if($(this).parents('.box1').find('.content').css("display")!='none'){
						$(this).parents('.box1').find('.content').slideUp('slow');
					}else{
						$(this).parents('.box1').find('.content').slideDown('slow');
					}
				});
				
				$('.box2 .titel').click(function(){
					if($(this).parents('.box2').find('.content').css("display")!='none'){
						$(this).parents('.box2').find('.content').slideUp('slow');
					}else{
						$(this).parents('.box2').find('.content').slideDown('slow');
					}
				});
				
				$('.box3 > legend').click(function(){
					if($(this).parents('.box3').find('.content').css("display")!='none'){
						$(this).parents('.box3').find('.content').slideUp('slow');
					}else{
						$(this).parents('.box3').find('.content').slideDown('slow');
					}
				});
				
				$('.box4 h3').click(function(){
					if($(this).parents('.box4').find('.content').css("display")!='none'){
						$(this).parents('.box4').find('.content').slideUp('slow');
						$(this).parents('.box4').removeClass('open');
						$(this).parents('.box4').addClass('close');
					}else{
						$(this).parents('.box4').find('.content').slideDown('slow');
						$(this).parents('.box4').removeClass('close');
						$(this).parents('.box4').addClass('open');
					}
				});
				
				$('.box1thin h3').click(function(){
					if($(this).parents('.box1thin').find('.content').css("display")!='none'){
						$(this).parents('.box1thin').find('.content').slideUp('slow');
					}else{
						$(this).parents('.box1thin').find('.content').slideDown('slow');
					}
				});
				
				$("#search").autocomplete("/index.php?eID=tx_whiteboard_pi1", {
					width: 350,
					matchContains: true,
					mustMatch: false,
					minChars: 2,
					extraParams: {
						key: function() { return $("#search").val(); }
					},
					selectFirst: false
				});
				
				$('div.box4').each(function(i) {
					if($(this).children(".content").css("display")=='block'){
						$(this).removeClass('close');
						$(this).addClass('open');
					}else{
						$(this).removeClass('open');
						$(this).addClass('close');
					}
				});

				$('.glossarEnties div.list div').click(function(){
					tmpListId 	= $(this).attr('id');
					tmpListArr 	= tmpListId.split('_');
					
					$('.glossarEnties div.list div').removeClass('activeGlossaryWord');
					$('.glossarEnties div.list div#'+tmpListId).addClass('activeGlossaryWord');
					
					$('.glossarEnties div.detail div').css('display', 'none');
					$('.glossarEnties div.detail div#d_'+tmpListArr[1]).css('display', 'block');
					
				});
				
				$("div.glossarEnties div.list div").mouseover(function() {
					$(this).addClass('GlossaryWordOver');
				}).mouseout(function(){
					$(this).removeClass('GlossaryWordOver');
				});

				// search
				//$("#search").focus();
				
	    });

/* load end */

function searchFocus(Obj){

	checkedWord = Obj.value;
	if(Obj.value=="Suche" || Obj.value=="Search"){
		Obj.value = '';
		Obj.style.color = '#2e2382';
	}
}

function searchBlur(Obj){
	if(Obj.value==""){
		Obj.value = checkedWord;
		Obj.style.color = '#d6d7d9';
	}
}

function FormatRegistrationFields(Obj){
  Obj.styles.background = '#ffffff';    
} 

function SubmitIPP(){
	document.forms['frmIPP'].submit();
}

function checkBildBox(objInput, objStr){
	frmObj 		= document.forms["frmProduct"];
	objHtml 	= document.getElementById(objStr+"html");
	if(objInput.value!='' && objHtml.innerHTML!='()'){
		frmObj[objStr].checked = "checked";
	}else{
		frmObj[objStr].checked = false;
	}
}

function deleteProduct(uid, confirmmessage, l){
	if(confirm(confirmmessage)){
		document.location.href = '/index.php?id=45&no_cache=1&L='+l+'&view=products&exe=product&mode=delete&uid='+uid;
	}
}

function showDetail(uid,l,producttitle,urlprefix){
//	document.location.href = '/index.php?id=giveaways&no_cache=1&pro='+uid+'&L='+l;
	document.location.href = urlprefix+'/'+uid+'/'+producttitle+'.html';
}

function CancelProduct(LangID){
	document.location.href = '/index.php?id=45&no_cache=1&view=products&L='+LangID;
} 

function ChangeImgPD(ImageToChange, BigImage){
	document.getElementById("previewImage").src = ImageToChange;
	$("#LinkHref").attr('href', BigImage);

}

function ChangeImgP(ImageToChange, BigImage){
	document.getElementById("previewImageP").src = ImageToChange;
	$("#LinkHrefP").attr('href', BigImage);

}

function ChangeImgQ(ImageToChange, BigImage){
	document.getElementById("previewImageQ").src = ImageToChange;
	$("#LinkHrefQ").attr('href', BigImage);

}

function CheckMailChange(Text1, Text2){
		frmObj 		= document.forms["frmChangeEmail"];
		if(confirm(Text1)){
			if(frmObj['email'].value!=frmObj['email2'].value || frmObj['email'].value==''){
				alert(Text2);
				return false;
			}else{
				return true;
			}
		}
}

function CheckPassChange(Text1, Text2){
	frmObj 		= document.forms["frmChangePass"];
		if(confirm(Text1)){
			if(frmObj['pass'].value!=frmObj['pass2'].value || frmObj['pass'].value==''){
				alert(Text2);
				return false;
			}else{
				return true;
			}
		}
}

function MessageInfo(divId){
	if($('#messageInfo_'+divId).css("display")!='none'){
		$('#messageInfo_'+divId).slideUp('slow', function() {});
	}else{
		$('#messageInfo_'+divId).slideDown('slow', function() {});
	}
}

function SendMessage(firmaName, CompanyMessageText1, CompanyMessageText2){
	frmObj 		= document.forms["frmMessage"];
	if(frmObj['name'].value=='' || frmObj['message'].value=='' || frmObj['email'].value==''){
		alert(CompanyMessageText1);
		return false;
	}else{
		alert(CompanyMessageText2);
		return true;
	}
}

function deleteMessage(mId, Mconf){
	if(confirm(Mconf)){
		document.location.href = '/index.php?id=45&no_cache=1&view=messages&mid='+mId+'&deleteM=1';
	}
}

function ShowPackageInfo(Obj){
	for(x=1;x<10;x++){
		if($('#detail_package_'+x)){
			$('#detail_package_'+x).hide();
		}
	}
	$('#detail_package_'+Obj.value).show();
	
	document.forms["frmRegistration"]["package"].value=Obj.value;
	
}

function checkCoupon(Obj){
	if(Obj.value!=''){
		document.forms["frmCoupon"].submit();
	}
}

function NoMore(Msg){
	alert(Msg);
}

function ProfileErr11(TxT, Lang){
	alert(TxT);
	document.location.href = '/index.php?id=45&no_cache=1&L='+Lang+'&view=profile';
}