function led(){ $(".back").fadeOut(800).fadeIn(800,function(){led();});};

$(document).ready(function() 
  {
	led();
	// Initialise Facebox Modal window:	
	$('a[rel*=modal]').facebox({
        loadingImage : 'images/loading.gif',
        closeImage   : 'images/closelabel.png'
      }); // Applies modal window to any link with attribute rel="modal"
  }
);
function action_hide()
        {
         var o = document.getElementById('nav');
         if(o.style.display=='none')
         {
          o.style.display == 'block';
         }
         if(o.style.display=='block')
         {
          o.style.display == 'none';
         }
        }
       function showhide(id)
        {
         var o = document.getElementById(id);
         if(o.style.display=='none')
         {
          o.style.display = 'block';
         } else
         if(o.style.display=='block')
         {
          o.style.display = 'none';
         }
        }
        function open_window(link,w,h) //opens new window
        {
                var win = "width="+w+",height="+h+",menubar=no,location=no,resizable=yes,scrollbars=yes";
                newWin = window.open(link,'newWin',win);
                newWin.focus();
        }

        function open_printable_version(link) //opens new window
        {
                var win = "menubar=no,location=no,resizable=yes,scrollbars=yes";
                newWin = window.open(link,'perintableWin',win);
                newWin.focus();
        }

        function confirmDelete(id, ask, url) //confirm order delete
        {
                temp = window.confirm(ask);
                if (temp) //delete
                {
                        window.location=url+id;
                }
        }



        function confirmUnsubscribe() //unsubscription confirmation
        {
                temp = window.confirm('{/literal}{$smarty.const.QUESTION_UNSUBSCRIBE}{literal}');
                if (temp) //delete
                {
                        window.location="index.php?killuser=yes";
                }
        }

        function validate() // newsletter subscription form validation
        {
                if (document.subscription_form.email.value.length<1)
                {
                        alert("{/literal}{$smarty.const.ERROR_INPUT_EMAIL}{literal}");
                        return false;
                }
                if (document.subscription_form.email.value == 'Email')
                {
                        alert("{/literal}{$smarty.const.ERROR_INPUT_EMAIL}{literal}");
                        return false;
                }
                return true;
        }
        function validate_disc() // review form verification
        {
                if (document.formD.nick.value.length<1)
                {
                        alert("{/literal}{$smarty.const.ERROR_INPUT_NICKNAME}{literal}");
                        return false;
                }

                if (document.formD.topic.value.length<1)
                {
                        alert("{/literal}{$smarty.const.ERROR_INPUT_MESSAGE_SUBJECT}{literal}");
                        return false;
                }

                return true;
        }
        function validate_search()
        {

                if (document.Sform.price1.value!="" && ((document.Sform.price1.value < 0) || isNaN(document.Sform.price1.value)))
                {
                        alert("{/literal}{$smarty.const.ERROR_INPUT_PRICE}{literal}");
                        return false;
                }
                if (document.Sform.price2.value!="" && ((document.Sform.price2.value < 0) || isNaN(document.Sform.price2.value)))
                {
                        alert("{/literal}{$smarty.const.ERROR_INPUT_PRICE}{literal}");
                        return false;
                }

                return true;
        }
	 function getProductIdToCart(productID,cnt)
	 {
		if(document.getElementById('current_product_'+productID) == null) product = productID; else product = document.getElementById('current_product_'+productID).value;
	 	//alert(count);  
	 	var cnt_str = '&cnt='+cnt;
	 	//alert('/cart.php?addproduct='+document.getElementById('current_product_'+productID).value+cnt_str);
		open_window('/cart.php?addproduct='+product+cnt_str,400,500);
	 }
	 function WrapToCart(id1,id2,id3)
	 {
		if(id1>0) open_window('/cart.php?addproduct='+id1+'&id2='+id2,400,500);
		if(id3>0) open_window('/cart.php?addproduct=0'+'&id2='+id2+'&id='+id3,400,500);
	 }
	 function PresentToCart(productID,presentID,product,cnt)
	 {
		if(productID>0) open_window('/cart.php?addproduct='+productID+'&presentID='+presentID+'&cnt='+cnt,400,500);
		if(product>0) open_window('/cart.php?addproduct=0'+'&presentID='+presentID+'&id='+product+'&cnt='+cnt,400,500);
	 }
        function association(ID,status)
	 {
	 	document.getElementById('activeProduct').value = ID;
		document.getElementById('selectedProducts_'+ID+'_'+status).checked = true;
		document.getElementById('association').submit();
	 }

function insertSelected(id)
{
	if (document.getSelection) 
	{
		var str = document.getSelection();

	} 
	else 
	if (document.selection.createRange()) 
	{
		var range = document.selection.createRange();
		var str = range.text;
	}else {
    var str = "Sorry, this is not possible with your browser.";}
	
	if(str != '')
	{
		document.getElementById('art_'+id).value = str;
	}
} 

function test()
{
jQuery(document).ready(function() {
            jQuery('#mycarousel1').jcarousel({
                scroll: 1
            });
        })
}
