$(document).ready(function() {
	$(".PriceListButton").click(function(event) {
		$(".PriceListHolder").slideToggle();
	});
});
	function ad() {	
		if ((document.location.href=='http://www.yaslaptop.ir/')
		 || (document.location.href=='http://www.yaslaptop.ir/index.php') 
		 || (document.location.href=='http://yaslaptop.ir/') 
		 || (document.location.href=='http://yaslaptop.ir/index.php') 
		 || (document.location.href=='yaslaptop.ir/') 
		 || (document.location.href=='yaslaptop.ir/index.php')) 
		{
			document.getElementById('page').style.height='1900px';
			document.getElementById('page').style.width= '100%';
			document.getElementById('page').style.visibility='visible';
			document.getElementById('inpage').style.visibility='visible';
			document.getElementById('inpage').style.zIndex="1"
		}
	}
	
	function adoff() {
		 document.getElementById('page').style.visibility='hidden';
		 document.getElementById('inpage').style.visibility='hidden';
		 document.getElementById('page').style.display='none';
		 document.getElementById('inpage').style.display='none'
	}

	function boxtoggle($bid) {
/*		if (document.getElementById(bid).style.display == "block")
		{
			document.getElementById(bid).style.display = "none";
		}
		else
		{
			document.getElementById(bid).style.display = "block";
		}*/
		$("#"+$bid).slideToggle();
	}

	var TimeToFade = 1000.0;
	
	function fade(eid)
	{
	  var element = document.getElementById(eid);
	  if(element == null)
	    return;
	   
	  if(element.FadeState == null)
	  {
	    if(element.style.opacity == null 
	        || element.style.opacity == '' 
	        || element.style.opacity == '1')
	    {
	      element.FadeState = 2;
	    }
	    else
	    {
	      element.FadeState = -2;
	    }
	  }
	    
	  if(element.FadeState == 1 || element.FadeState == -1)
	  {
	    element.FadeState = element.FadeState == 1 ? -1 : 1;
	    element.FadeTimeLeft = TimeToFade - element.FadeTimeLeft;
	  }
	  else
	  {
	    element.FadeState = element.FadeState == 2 ? -1 : 1;
	    element.FadeTimeLeft = TimeToFade;
	    setTimeout("animateFade(" + new Date().getTime() + ",'" + eid + "')", 33);
	  } 
	}
	function animateFade(lastTick, eid)
	{  
	  var curTick = new Date().getTime();
	  var elapsedTicks = curTick - lastTick;
	  
	  var element = document.getElementById(eid);
	 
	  if(element.FadeTimeLeft <= elapsedTicks)
	  {
	    element.style.opacity = element.FadeState == 1 ? '1' : '0';
	    element.style.filter = 'alpha(opacity = ' 
	        + (element.FadeState == 1 ? '100' : '0') + ')';
	    element.FadeState = element.FadeState == 1 ? 2 : -2;
	    return;
	  }
	 
	  element.FadeTimeLeft -= elapsedTicks;
	  var newOpVal = element.FadeTimeLeft/TimeToFade;
	  if(element.FadeState == 1)
	    newOpVal = 1 - newOpVal;
	
	  element.style.opacity = newOpVal;
	  element.style.filter = 'alpha(opacity = ' + (newOpVal*100) + ')';
	  
	  setTimeout("animateFade(" + curTick + ",'" + eid + "')", 33);
	}

	function control(fadingblockID) {
	fade(fadingblockID);
	setTimeout("control('"+fadingblockID+"');",2000);
	}


	function open_window(link,w,h) //opens new window
	{
		var win = "width="+w+",height="+h+",menubar=no,location=no,resizable,scrollbars";
		newWin = window.open(link,'newWin',win);
		newWin.focus();
	}

	function open_printable_version(link) //opens new window
	{
		var win = "menubar=no,location=no,resizable,scrollbars";
		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";
		}
	}

	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;
	}
