jQuery(document).ready(function() {
	//destroy the countdown befor ajax load jk
jQuery(".subnav_ajax").each(function(){
			jQuery(this).click(function(){
										if(document.getElementById("countdown_product_1")){
	jQuery('#countdown_product_1').countdown('destroy');
										};
									  });									 
									 });								
jQuery(".subnav_ajax").ajaxContent({target:'#ajax_putin',loaderType:'img',loadingMsg:'images/loading.gif',returning:'true'});

do_ie_focus();

jQuery('#categories_container').accordion({

  header: '.title',

  selectedClass:'title_active',

  event: 'click',

  autoheight: false,

  active: false,

  animated:'firstclose',

  alwaysOpen:true});

do_ship_link();


});



function show_flash(widht,height,src,cyt,trans)
{
if (window.ActiveXObject)
{
document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="https://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="'+widht+'" height="'+height+'" id="'+src+'">');
document.write('<param name="allowScriptAccess" value="always" />');
document.write('<param name="movie" value="'+src+'" />');
document.write('<param name="quality" value="high" />');
document.write('<param name="wmode" value="'+trans+'">');
document.write('<param name="bgcolor" value="#ffffff" />');
document.write('<PARAM NAME=FlashVars VALUE="'+cyt+'">');
document.write('<embed src="'+src+'" quality="high" FlashVars="'+cyt+'" bgcolor="#ffffff" width="'+widht+'" height="'+height+'" name="'+src+'" align="middle" allowScriptAccess="always" type="application/x-shockwave-flash" pluginspage="https://www.macromedia.com/go/getflashplayer" wmode="'+trans+'" />');
document.write('</object>');
}
else
{
document.write('<object id="'+src+'" data="'+src+'" type="application/x-shockwave-flash" width="'+widht+'" height="'+height+'">');
document.write('<param name="allowScriptAccess" value="always" />');
document.write('<param name="movie" value="'+src+'" />');
document.write('<param name="quality" value="high" />');
// document.write('<param name="wmode" value="'+trans+'">');
document.write('<param name="bgcolor" value="#ffffff" />');
document.write('<PARAM NAME=FlashVars VALUE="'+cyt+'">');
document.write('<embed src="'+src+'" quality="high" FlashVars="'+cyt+'" bgcolor="#ffffff" width="'+widht+'" height="'+height+'" name="'+src+'" align="middle" allowScriptAccess="always" type="application/x-shockwave-flash" pluginspage="https://www.macromedia.com/go/getflashplayer" />');
document.write('</object>');
}
}
  function doAjaxSubmit(){
var options = { 
        target:        '#ajax_putin',
		beforeSubmit:  function(){jQuery("#ajax_putin").html('<div class="ajax_loading"><img src="images/loading.gif"/>&nbsp;</div>');										if(document.getElementById("countdown_product_1")){
	jQuery('#countdown_product_1').countdown('destroy');
										};},
		data: ['ajax'],  
        success:       function() {do_ship_link();}  
		
		}
		jQuery('#use_filters').ajaxSubmit(options); 
		return false;
}
  function getNewFilters(){
	var options = { 
        target:        '#box_special_filters',
		beforeSubmit:  function(){jQuery("#ajax_get_filters").html('<div class="ajax_loading_get_filters"><img src="images/loading_small.gif"/>&nbsp;</div>');										if(document.getElementById("countdown_product_1")){
	jQuery('#countdown_product_1').countdown('destroy');
										};},
		data: ['ajax_getNewFilters'],  
        success:       function() {doAjaxSubmit();do_ie_focus();}  
		
		}
		jQuery('#use_filters').ajaxSubmit(options); 
		return false;
}

 function do_ship_link(){
	jQuery(".ship_link").click(function(){

window.open(jQuery(this).attr('href'),'popup','toolbar=0, scrollbars=yes, resizable=yes, height=720, width=750');

return false;}); 
 }
 
 var submitter = null;
function submitFunction() {
   submitter = 1;
   }
   
   function showthumb(i){   
	document.getElementById("pic"+i).style.visibility = "visible";
}
		
var bildArray=new Array(1,2,3);
function bild(nummer){
	$('#bild_attributes').remove();
	if(document.getElementById)
	for (a=0;a<bildArray.length;a++){
		if(bildArray[a]!=nummer){
			document.getElementById("bild"+bildArray[a]).style.display = "none";
		}else{
			document.getElementById("bild"+nummer).style.display = "block";
		}
	}
}

function do_ie_focus(){
if(jQuery.browser.msie){
	jQuery('#filter_dd_2').children().bind('mouseout',function(){alert('fsd')});
jQuery('#filter_dd_2').bind('mouseover',function(){jQuery(this).focus();jQuery(this).animate({width:'270px'},{duration:1},'',function(){jQuery('#filter_dd_2').unbind('mouseover')});});
jQuery('#filter_dd_2').bind('blur',function(){jQuery(this).animate({width:'141px'},{duration:1},'',function(){jQuery('#filter_dd_2').bind('mouseover',function(){jQuery(this).focus();jQuery(this).animate({width:'270px'},{duration:1},'',function(){jQuery('#filter_dd_2').unbind('mouseover')});});})});
}	
}


function put_it_in(data,mod_objekt){show_loader('hide');if(typeof(data.error)!='undefined'){mod_url_to_go=check_ssl(data.error);setTimeout(function(){window.location.href=mod_url_to_go},100);}else{if(typeof(data.url_to_get)!='undefined'){$.ajax({url:check_ssl(data.url_to_get),data:{ajax:1},success:function(html_of_data){show_loader('hide');$('#putin_main').html(html_of_data);do_cart_quanty_init();},beforeSend:function(){show_loader('show');}});}
if(typeof(data.items)!='undefined'){$.each(data.items,function(json_id,json_data){$(json_data.update_select).effect('highlight',{color:'#db009c'},750);$(json_data.update_select).html(json_data.update_text);});}}}
function check_ssl(mod_url){if(typeof mod_url!='undefined'){var mod_href='';if(typeof cyt_ajax_request!='undefined'){var mod_href=mod_url.replace(cyt_ajax_normal_server,cyt_ajax_ssl_server)}else{var mod_href=mod_url;}
return mod_href;}}
function show_loader(what){if(what=='show'){$.blockUI({message:'<img src="images/loading.gif" />',css:{width:'',margin:'0 0 0 -80px',left:'50%',border:'1px solid #dd4908'},showOverlay:false,overlayCSS:{opacity:0}});}else{$.unblockUI();}}
function do_variation_change_init(){if($('select[name^=id]').length||$('input[name^=id]').length){var checked_basename=check_ssl($('form:has(input[name=products_qty])').attr('action'));var options={url:checked_basename,dataType:'json',data:{ajax:'ajax_calls',what:'get_price'},beforeSubmit:function(){show_loader('show')},success:function(data){put_it_in(data);}};$('form:has(input[name=products_qty])').ajaxSubmit(options);}
$('select[name^=id],input[name^=id]').each(function(){if($('input[name^=id]').length){$(this).bind('click',function(){do_the_change_call(this)});}else if($('select[name^=id]').length){$(this).bind('change',function(){do_the_change_call(this)});};});var search_timeout=undefined;$('input[name=products_qty]').bind('keyup',function(){if(search_timeout!=undefined){clearTimeout(search_timeout);}
var $this=this;search_timeout=setTimeout(function(){search_timeout=undefined;var checked_basename=check_ssl($('form:has(input[name=products_qty])').attr('action'));var options={url:checked_basename,dataType:'json',data:{ajax:'ajax_calls',what:'get_price'},beforeSubmit:function(){show_loader('show')},success:function(data){put_it_in(data);}};$('form:has(input[name=products_qty])').ajaxSubmit(options);},750);});$('.attributes_image').each(function(){$(this).children('img').click(function(){$(this).parent('.attributes_image').next().children('input').select();do_the_change_call(this);});});}
function do_the_change_call(wich_one){var selected_one='';if($(wich_one).attr('value')){var selected_one=$(wich_one).parent().prev('.attributes_image').children('img');}else{var selected_one=$(wich_one);}
bild(1);if(typeof(selected_one.attr('name'))!='undefined'){/*$('#bild1').hide();var selected_one_changed=selected_one;$('.bg_image_big').append('<div id="bild_attributes">'+'<img src="images/attributes_images/info_images/'+selected_one_changed.attr('name')+'.jpg" />'+'</div>');*/}
var checked_basename=check_ssl($('form:has(input[name=products_qty])').attr('action'));var options={url:checked_basename,dataType:'json',data:{ajax:'ajax_calls',what:'get_price'},beforeSubmit:function(){show_loader('show');$("html").animate({scrollTop:100},1000);},success:function(data){put_it_in(data);}};$('form:has(input[name=products_qty])').ajaxSubmit(options);}