function open_window(link,w,h) {
    var win = "width="+w+",height="+h+",menubar=no,location=no,resizable=no,scrollbars=no,align=center";
    newWin = window.open(link,'newWin',win);
    newWin.focus();
}
function open_window2(link,w,h) {
    var win = "width="+w+",height="+h+",menubar=no,location=no,resizable=no,scrollbars=no";
    newWin = window.open(link,'newWin',win);
    newWin.focus();
}
function open_window3(link,w,h) {
    var win = "width="+w+",height="+h+",menubar=yes,location=yes,resizable=yes,scrollbars=yes";
    newWin = window.open(link,'newWin',win);
    newWin.focus();
}


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

	function confirmDelete_(id, ask, url) { //confirm order delete
		temp = window.confirm(ask);
		if (temp) { //delete
			window.location=url+id;
			window.location.reload();
		};
	};
function validate() {
    if (document.form1.email.value.length<1) {
        alert("Please input your e-mail");
        return false;
    };
    if (document.form1.email.value == 'Email') {
        alert("Please input your e-mail");
        return false;
    };
    return true;
}
function validate_disc() {
    if (document.formD.nick.value.length<1) {
        alert("Please input your nickname");
        return false;
    };

    if (document.formD.topic.value.length<1) {
        alert("Please input post subject");
        return false;
    };

    return true;
}
function validate_search() {

    if (document.Sform.price1.value!="" && ((document.Sform.price1.value < 0) || isNaN(document.Sform.price1.value))) {
        alert("Price should be a positive number");
        return false;
    };
    if (document.Sform.price2.value!="" && ((document.Sform.price2.value < 0) || isNaN(document.Sform.price2.value))) {
        alert("Price should be a positive number");
        return false;
    };

    return true;
}
function go(url) {
    document.location.href=url;

}


function rad(x)
{
  setCookie('optavik', x, null);
window.location.reload(); 
}
function rad_(x)
{
  setCookie('optavik2', x, null);
window.location.reload(); 
}
function sort_price(x)
{
  setCookie('sort_price', x, null);
window.location.reload(); 
}
function ca(x)
{
  setCookie('cat_', x, null);
window.location.reload(); 
}
function la(x)
{
  setCookie('lang', x, null);
window.location.reload(); 
}
function cur(x)
{
  setCookie('currency', x, null);
window.location.reload(); 
}

function setCookie(cookieName,cookieValue,nDays)
{
 var today = new Date();
 var expire = new Date();
 if (nDays==null || nDays==0) nDays=9999;
 expire.setTime(today.getTime() + 3600000*24*nDays);
 document.cookie = cookieName+'='+escape(cookieValue)+';expires='+expire.toGMTString();
}