function slideshow(header_slideshow)
{		
		/***************SLIDE SHOW*****************/				
		var header_flashvars = {
			paramXMLPath: "param.xml",
			initialURL: escape(document.location),
			useExternalInterface: "true",
			contentScale: "None",
			navAppearance: "Hidden",
			autoFinishMode: "Restart",		
			feedbackPreloaderAppearance: "Hidden",						
			contentAreaStrokeAppearance: "Hidden",
			feedbackTimerAppearance: "Hidden",
			xmlFilePath: "../images_header_slideshow.php?id="+header_slideshow 		
		}
		var header_params = { 
			base: ".",
			allowfullscreen: "true",
			wmode:"transparent"
		}
		var header_attributes = {}
		swfobject.embedSWF("swf/slideshowpro.swf", "flash_inner", "654", "315", "9.0.0", false, header_flashvars, header_params, header_attributes);	
		
		/***************END SLIDE SHOW*****************/
		
}
function printPage(print_page){
	window.open( print_page, 'print', 'toolbar=no,scrollbars=yes,location=no,statusbar=no,menubar=no,resizable=yes,width=698,height=700');
}

function recToFriend(page, obj)
{
	$('#actionBox').center();
	$('#actionBox').show();
	$('#actionBox').load('jax/tellToFriend.jax.php', { 'page':page}); 
}
jQuery.fn.center = function () {
    this.css("position","absolute");
    this.css("top", ( $(window).height() - this.height() ) / 2+$(window).scrollTop() + "px");
    this.css("left", ( $(window).width() - this.width() ) / 2+$(window).scrollLeft() + "px");
    return this;
}

$(document).ready(function(){
	$('.lang').attr("href","javascript:void(0)");
    $(document).pngFix(); 
	$(".button_1").hover(function(){
		$(this).toggleClass('button_1'); 
		$(this).addClass('button_1_over');
		$('#submenumain_1').show();
		$(this).toggleClass('menu_hover'); 
	},function(){	
		$(this).toggleClass('button_1'); 
		$(this).removeClass('button_1_over'); 
		$('#submenumain_1').hide();
		$(this).toggleClass('menu_hover'); 
	})
	$(".button_2").hover(function(){
		$(this).toggleClass('button_2'); 
		$(this).addClass('button_2_over');
		$('#submenumain_2').show();
		$(this).toggleClass('menu_hover'); 
	},function(){	
		$(this).toggleClass('button_2'); 
		$(this).removeClass('button_2_over'); 
		$('#submenumain_2').hide();
		$(this).toggleClass('menu_hover'); 
	})
	$(".button_3").hover(function(){
		$(this).toggleClass('button_3'); 
		$(this).addClass('button_3_over');
		$('#submenumain_3').show();
		$(this).toggleClass('menu_hover'); 
	},function(){	
		$(this).toggleClass('button_3'); 
		$(this).removeClass('button_3_over'); 
		$('#submenumain_3').hide();
		$(this).toggleClass('menu_hover'); 
	})
	$(".button_4").hover(function(){
		$(this).toggleClass('button_4'); 
		$(this).addClass('button_4_over');
		$('#submenumain_4').show();
		$(this).toggleClass('menu_hover'); 
	},function(){	
		$(this).toggleClass('button_4'); 
		$(this).removeClass('button_4_over'); 
		$('#submenumain_4').hide();
		$(this).toggleClass('menu_hover'); 
	})
	$(".button_5").hover(function(){
		$(this).toggleClass('button_5'); 
		$(this).addClass('button_5_over');
		$('#submenumain_5').show();
		$(this).toggleClass('menu_hover'); 
	},function(){	
		$(this).toggleClass('button_5'); 
		$(this).removeClass('button_5_over'); 
		$('#submenumain_5').hide();
		$(this).toggleClass('menu_hover'); 
	})
	$(".button_6").hover(function(){
		$(this).toggleClass('button_6'); 
		$(this).addClass('button_6_over');
		$('#submenumain_6').show();
		$(this).toggleClass('menu_hover'); 
	},function(){	
		$(this).toggleClass('button_6'); 
		$(this).removeClass('button_6_over'); 
		$('#submenumain_6').hide();
		$(this).toggleClass('menu_hover'); 
	})
	$(".submit_button").hover(function(){
		$(this).toggleClass('submit_button_hover');
	},function(){	
		$(this).toggleClass('submit_button_hover'); 
	})

$(".submenu").hover(function(){$(this).toggleClass('submenu_over');}, function(){$(this).toggleClass('submenu_over');})
});

var var_order='products_title ASC';
var search_condition = '';
var cart_first = 1;
function load_popup(){
	$('.popup').slideToggle(600,function(){hide_popup()});	
}
function hide_popup(){
	setTimeout("$('.popup').slideToggle(600);",3000);	
}
 $(document).scroll(function() {
$("#popup").animate( { top:$(document).scrollTop() },0 )
});

function displayProducts(page,order,howmany,cats_string,search_c,zub)
{
	$('#product_display_div').load('jax/display_products.jax.php', {page: page, order: order, howmany : howmany, cats_string: cats_string, search_cond: search_c, zub: zub }, function(){
$("a.group").fancybox({ 'zoomSpeedIn': 300, 'zoomSpeedOut': 300, 'overlayShow': false, 'hideOnContentClick': false, 'frameWidth' : 600, 'frameHeight': $('#versand_content').height()+10, 'overlayOpacity': 0.8 });
	$('.Add_button').qtip({
   									content: txt_add,
   									show: 	{ 
   												when: { event: 'mouseup'},
   												delay: 0
   											},
   									hide: {
   												when: { event: 'inactive'},
   												delay: 3000
   											},
   									position: {
    										  	corner: {
         													target: 'topRight',
         													tooltip: 'bottomLeft'
   				   										}
   											}			,
									style: { 
      											background: '#291302',
      											color: 'white',
												border: {
        													  width: 3,
       														  radius: 5,
       														  color: '#ae9b8b'
      													},

												tip: {
      													corner: 'bottomLeft', 
        											 	color: '#ae9b8b'
      												}
      										}

										}) 
});
}


function addToCart(id,zub)
{
	$('#sc_bottom').load('jax/add_products_to_cart.jax.php', {product_id: id, zub:zub}, function(){
$("a.group").fancybox({ 'zoomSpeedIn': 300, 'zoomSpeedOut': 300, 'overlayShow': false, 'hideOnContentClick': false, 'frameWidth' : 600, 'frameHeight': $('#versand_content').height()+10, 'overlayOpacity': 0.8 }); 
});
}

function deleteFromCart(id)
{
	$('#sc_bottom').load('jax/delete_products_from_cart.jax.php', {product_id: id}, function(){
$("a.group").fancybox({ 'zoomSpeedIn': 300, 'zoomSpeedOut': 300, 'overlayShow': false, 'hideOnContentClick': false, 'frameWidth' : 600, 'frameHeight': $('#versand_content').height()+10, 'overlayOpacity': 0.8 }); 
});
}

function addOneMore(id, key, fval,zub)
{
	$('#sc_bottom').load('jax/add_one_more.jax.php', {product_id: id, zub: zub}, function(){ if ($('#menge'+key).val() == fval ) {$('#cp_stock_alert'+key).show("slide", {direction:"up"}, 600,function(){setTimeout("$('#cp_stock_alert"+ key + "').hide('slide', {direction:'down'}, 600)",3000);})}
$("a.group").fancybox({ 'zoomSpeedIn': 300, 'zoomSpeedOut': 300, 'overlayShow': false, 'hideOnContentClick': false, 'frameWidth' : 600, 'frameHeight': $('#versand_content').height()+10, 'overlayOpacity': 0.8 }); 
});
}

function takeOneOut(id)
{
	$('#sc_bottom').load('jax/take_one_out.jax.php', {product_id: id}, function(){
$("a.group").fancybox({ 'zoomSpeedIn': 300, 'zoomSpeedOut': 300, 'overlayShow': false, 'hideOnContentClick': false, 'frameWidth' : 600, 'frameHeight': $('#versand_content').height()+10, 'overlayOpacity': 0.8 }); 
});
}

function displayCart()
{
	$('#sc_bottom').load('jax/display_cart.jax.php', function(){
$("a.group").fancybox({ 'zoomSpeedIn': 300, 'zoomSpeedOut': 300, 'overlayShow': false, 'hideOnContentClick': false, 'frameWidth' : 600, 'frameHeight': $('#versand_content').height()+10, 'overlayOpacity': 0.8 });});
}


$(document).ready(function(){	
	$('#up_and_down').toggle(function() {
 								$('.shopping_cart').animate({height: "233px"},"slow");
 								$('html, body').animate({
scrollTop: $(window).height()}, 2000);
							 }, 
				function() {
							 	 $('.shopping_cart').animate({height: "23px"},"slow")
							});
});

function whereTo()
{
	$('#jax_div').load('jax/where_to.jax.php');		
}

function checkStock(id, field, key)
{
	$.getJSON("jax/check_stock.jax.php", {'id_prod': id, 'field_val': field.value},
	  function(data){ 
			if (data.stock_val < field.value) { field.value = data.stock_val; $('#cp_stock_alert'+key).show("slide", {direction:"up"}, 600,function(){setTimeout("$('#cp_stock_alert"+ key + "').hide('slide', {direction:'down'}, 600)",3000);
	  });
	  setTimeout("displayCart()",4200);
	}
	 else {displayCart();}
	})
}

function modifyQuantity(id, field)
{
	$('#sc_bottom').load('jax/mod_quantity.jax.php', {product_id: id, field_val: field.value}, function(){$("a.group").fancybox({ 'zoomSpeedIn': 300, 'zoomSpeedOut': 300, 'overlayShow': false, 'hideOnContentClick': false, 'frameWidth' : 600, 'frameHeight': $('#versand_content').height()+10, 'overlayOpacity': 0.8 }); });
}

function displayOrder()
{
	$('#order_content').load('jax/display_order.jax.php');
}

function modifyQuantity2(id, field)
{
	$('#order_content').load('jax/mod_quantity_order.jax.php', {product_id: id, field_val: field.value}, function(){$("a.group").fancybox({ 'zoomSpeedIn': 300, 'zoomSpeedOut': 300, 'overlayShow': false, 'hideOnContentClick': false, 'frameWidth' : 600, 'frameHeight': $('#versand_content').height()+10, 'overlayOpacity': 0.8 }); });
}


function checkStock2(id, field, key)
{
	$.getJSON("jax/check_stock.jax.php", {'id_prod': id, 'field_val': field.value},
	  function(data){
			if (data.stock_val < field.value) { field.value = data.stock_val; $('#cp_stock_alert2_'+key).show("slide", {direction:"up"}, 600,function(){setTimeout("$('#cp_stock_alert2_"+ key + "').hide('slide', {direction:'down'}, 600)",3000);
	  });
	 setTimeout("displayOrder()",4200);
	} else {displayOrder();}
	})
}

function deleteFromOrder(id)
{
	$('#order_content').load('jax/delete_products_from_order.jax.php', {product_id: id}, function(){
$("a.group").fancybox({ 'zoomSpeedIn': 300, 'zoomSpeedOut': 300, 'overlayShow': false, 'hideOnContentClick': false, 'frameWidth' : 600, 'frameHeight': $('#versand_content').height()+10, 'overlayOpacity': 0.8 }); 
});
}

function addOneMoreToOrder(id, key, fval, zub)
{
	$('#order_content').load('jax/add_one_more_to_order.jax.php', {product_id: id, zub: zub}, function(){
		if ($('#menge2_'+key).val() == fval ) {$('#cp_stock_alert2_'+key).show("slide", {direction:"up"}, 600,function(){setTimeout("$('#cp_stock_alert2_"+ key + "').hide('slide', {direction:'down'}, 600)",3000);})}
$("a.group").fancybox({ 'zoomSpeedIn': 300, 'zoomSpeedOut': 300, 'overlayShow': false, 'hideOnContentClick': false, 'frameWidth' : 600, 'frameHeight': $('#versand_content').height()+10, 'overlayOpacity': 0.8 }); 
});
}

function takeOneOutFromOrder(id)
{
	$('#order_content').load('jax/take_one_out_from_order.jax.php', {product_id: id}, function(){
$("a.group").fancybox({ 'zoomSpeedIn': 300, 'zoomSpeedOut': 300, 'overlayShow': false, 'hideOnContentClick': false, 'frameWidth' : 600, 'frameHeight': $('#versand_content').height()+10, 'overlayOpacity': 0.8 }); 
});
}
function login_function(){
	$('#login_error').load('jax/verify_login.jax.php',{'login':$('#login').val(), 'password':$('#password_login').val()},function(){if($('#correct_login').val()==1) document.forms["login"].submit(); else return false;});	
}
function login_function_validate(){
	$('#login_error_login').load('jax/verify_login_login.jax.php',{'login':$('#login_login').val(), 'password':$('#login_password').val()},function(){if($('#login_correct_login').val()==1) document.forms["login_login"].submit(); else return false;});	
}
function verify_function_validate(){
	$('#verify_error_login').load('jax/verify_login_verify.jax.php',{'login':$('#verify_login_field').val(),'login2':$('#verify_login_field1').val(),'code':$('#verify_code').val()},function(){if($('#verify_correct_login').val()==1) document.forms["verify_login"].submit(); else return false;});	
}

function change_lang(lang,plink){
	/*$('#container_test').load('jax/change_lang.jax.php',{'lang':lang},function(){window.location.href=plink;});	*/
	$.ajax({
	  type: "POST",
	  url: "jax/change_lang.jax.php",
	  data:'lang='+lang,
	  success: function(html){		  			  	
	  	if(html!=''){window.location.href=html;}else {window.location.reload();}
	  }
	});
}

function logout(link){
	$('#container_test').load('jax/logout.jax.php',{'lang':''},function(){window.location.href=link;});	
}

function scrollWin(){
$('html, body').animate({
scrollTop: $(window).height()}, 2000)}

function build_submenu (i,j)
{
	$('#submenu_sign{$smarty.section.i.index}_{$smarty.section.j.index}').toggle(function() {
 								 $('#subsub_container_'+i+'_'+j).show("slow");
								 $('#submenu_sign'+i+'_'+j).removeClass('closed_menu').addClass('open_menu');
								 $('#right_submenu_item'+i+'_'+j+' A').css('color','#ffffff');
							 }, 
						function() { 
							 	  $('#subsub_container_'+i+'_'+j).hide();
							 	  $('#submenu_sign'+i+'_'+j).removeClass('open_menu').addClass('closed_menu');
							 	  $('#right_submenu_item'+i+'_'+j+' A').css('color','#ad9e92');
							});
}

function modifyPayment(payment_id)
{
	$('#order_content').load('jax/modify_payment.jax.php', {payment_id: payment_id}, function(){
$("a.group").fancybox({ 'zoomSpeedIn': 300, 'zoomSpeedOut': 300, 'overlayShow': false, 'hideOnContentClick': false, 'frameWidth' : 600, 'frameHeight': $('#versand_content').height()+10, 'overlayOpacity': 0.8 }); 
});
}

function load_paypal(ord_id, shipping){
	$('#pp_target').load('jax/paypal.jax.php',{ord_id:ord_id, shipping:shipping});
}
