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 insPNG(f,w,h)
	{
		var st = "width:"+w+"px; height:"+h+"px;";

		if (navigator.appName=="Netscape" || navigator.userAgent.indexOf("Opera")!=-1)
		{
			document.write("<div style=\"" + st + "\"><img src=\""+f+"\" width=\""+w+"\" height=\""+h+"\" border=\"0\"/></div>");  
		}
		else
		{
			document.write("<div style=\"" + st + " filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+f+"', sizingMethod='scale')\"><table border=\"0\" cellspacing=\"0\" cellpadding=\"0\" width=\""+w+"\" height=\""+h+"\"><tr><td></td></tr></table></div>");
		}
	}

	
var n = 0;

var baner = getCookie('banershow');

if(baner == null)
{
	n = 0;
}
else
{
	if(baner != 0)
	{
		n = baner;
	}
	else
	{
		n = 0;	
	}
}

var banerimg = new Array("http://www.club-cdma.com.ua/baners/clubcdma_780_50.gif","http://www.shop.compservice.od.ua/baners/banner_260609.gif");
var banerurl = new Array("http://www.club-cdma.com.ua/","http://www.shop.compservice.od.ua/");

function element(id)
{
	return document.getElementById ? document.getElementById(id) : document.all[id];
}

function rightrotate()
{
	
	document.write("<a href='"+banerurl[n]+"' target='_blank'><img src='"+banerimg[n]+"' border=0></a>");
	(n == (banerimg.length-1))? n=0 : n++;
	setCookie("banershow", n, "", "/");
}

function getCookie(name) {
	var cookie = " " + document.cookie;
	var search = " " + name + "=";
	var setStr = null;
	var offset = 0;
	var end = 0;
	if (cookie.length > 0) {
		offset = cookie.indexOf(search);
		if (offset != -1) {
			offset += search.length;
			end = cookie.indexOf(";", offset)
			if (end == -1) {
				end = cookie.length;
			}
			setStr = unescape(cookie.substring(offset, end));
		}
	}
	return(setStr);
}

function setCookie (name, value, expires, path, domain, secure) {
      document.cookie = name + "=" + escape(value) +
        ((expires) ? "; expires=" + expires : "") +
        ((path) ? "; path=" + path : "") +
        ((domain) ? "; domain=" + domain : "") +
        ((secure) ? "; secure" : "");
}
