function ref(object)
{
    if (document.getElementById)
    {
        return document.getElementById(object);
    }
    else if (document.all)
    {
        return eval('document.all.' + object);
    }
    else
    {
        return false;
    }
}

function select_all (obj) {
    var ids = document.getElementsByName(obj);
    for (i=0;i<ids.length ;i++ ) {
        ids[i].checked = 'checked';
    }
}
function select_none (obj) {
    var ids = document.getElementsByName(obj);
    for (i=0;i<ids.length ;i++ ) {
        ids[i].checked = '';
    }
}

function jumpMenu(url){
        window.location.href = url;
}
function form_check() {
	var msg = "";
	if (ref("names").value == '') msg += "Моля попълнете имената си! \n";
	if (ref("email").value == '') msg += "Моля попълнете e-mail  адрес! \n";
	if (ref("telephone").value == '') msg += "Моля попълнете телефон! \n";
	
	if (msg != '') {
		alert(msg);
		return false;
	}
	return true;
}

//ORDER AJAX
function order_set(url) {

//	var quantity = prompt("Моля посочете бройката за този продукт","1");
	var quantity = 1;
	
	if(quantity == null) return false;
	
	url = url + "&quantity=" + quantity;

	var opt = {
	    // Use POST
	    // Handle successful response
	     method:'get' ,
	    onSuccess: function(t) {
	
	        eval(t.responseText);
	        if (jsarray['error'] != '') {
	            alert(jsarray['error']);
	        } else {
	            $('order_items').value = jsarray['order_items'];
	            if (confirm(jsarray['success_msg'])) {
	                window.location.href = jsarray['success_url'];
	            }
	        }
	    },
	    // Handle 404
	    on404: function(t) {
	        alert('Error 404: location "' + t.statusText + '" was not found.');
	    },
	    // Handle other errors
	    onFailure: function(t) {
	        alert('Error ' + t.status + ' -- ' + t.statusText);
	    }
	}

    new Ajax.Request(url, opt);
}


function setCookie(c_name,value,expiredays)
{
    if (value == 'none'){
        value = '';
    } else {
        value = 'none';
    }
var exdate=new Date()
exdate.setDate(exdate.getDate()+expiredays)
document.cookie=c_name+ "=" +value+
((expiredays==null) ? "" : ";expires="+exdate.toGMTString())
}
/*
//Disable right mouse click Script
//By Maximus (maximus@nsimail.com) w/ mods by DynamicDrive
//For full source code, visit http://www.dynamicdrive.com

var message="";
///////////////////////////////////
function clickIE() {if (document.all) {(message);return false;}}
function clickNS(e) {if 
(document.layers||(document.getElementById&&!document.all)) {
if (e.which==2||e.which==3) {(message);return false;}}}
if (document.layers) 
{document.captureEvents(Event.MOUSEDOWN);document.onmousedown=clickNS;}
else{document.onmouseup=clickNS;document.oncontextmenu=clickIE;}

document.oncontextmenu=new Function("return false")


//form tags to omit in NS6+:
var omitformtags=["input", "textarea", "select"]

omitformtags=omitformtags.join("|")

function disableselect(e){
if (omitformtags.indexOf(e.target.tagName.toLowerCase())==-1)
return false
}

function reEnable(){
return true
}

if (typeof document.onselectstart!="undefined")
document.onselectstart=new Function ("return false")
else{
document.onmousedown=disableselect
document.onmouseup=reEnable
}
*/


//  End -->

