


function GetXmlHttpObject()
{
    var xmlHttp=null;
    try
    {
        // Firefox, Opera 8.0+, Safari
        xmlHttp=new XMLHttpRequest();
    }
    catch (e)
    {
        // Internet Explorer
        try
        {
            xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
        }
        catch (e)
        {
            xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
        }
    }
    return xmlHttp;
}


function updateSideCart(){

    var xmlHttp = GetXmlHttpObject();
	
    var params = "";
    xmlHttp.open("POST", "/browse/cart/action/updateSideCart/", true);

    //Send the proper header information along with the request
    xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
    xmlHttp.setRequestHeader("Content-length", params.length);
    xmlHttp.setRequestHeader("Connection", "close");
    xmlHttp.onreadystatechange = function() {
        if (xmlHttp.readyState == 4 && xmlHttp.status == 200) {
            var response = new String(xmlHttp.responseText);
            document.getElementById('sideCart').innerHTML = response;
		  
        }
    }
    xmlHttp.send(params);
}

function updateProducQuantytInCart(idop, idproduct){

    var xmlHttp = GetXmlHttpObject();
   var quanty = document.getElementById('opQuanty_' + idproduct).value;
    var params = "idop=" + idop + "&quanty=" + quanty;
    xmlHttp.open("POST", "/browse/cart/action/updateProductQuanty/", true);

    //Send the proper header information along with the request
    xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
    xmlHttp.setRequestHeader("Content-length", params.length);
    xmlHttp.setRequestHeader("Connection", "close");
    xmlHttp.onreadystatechange = function() {
        if (xmlHttp.readyState == 4 && xmlHttp.status == 200) {
            var response = new String(xmlHttp.responseText);
            document.getElementById(idproduct).innerHTML = response;
		  
        }
    }
    xmlHttp.send(params);
}

function addToCart(idproduct, idprice, resp){

    var xmlHttp = GetXmlHttpObject();
    var params = "idproduct=" + idproduct + "&idprice=" + idprice + "&resp=" + resp;
    xmlHttp.open("POST", "/browse/cart/action/add/", true);

    //Send the proper header information along with the request
    xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
    xmlHttp.setRequestHeader("Content-length", params.length);
    xmlHttp.setRequestHeader("Connection", "close");
    xmlHttp.onreadystatechange = function() {
        if (xmlHttp.readyState == 4 && xmlHttp.status == 200) {
            if (resp == 1) {
                var response = new String(xmlHttp.responseText);
                document.getElementById('del_'+idproduct).value = response;
            } else if (resp == 2) {
                var response = new String(xmlHttp.responseText);
                document.getElementById('del_'+idproduct).value = response;
                document.getElementById('txtarea').value = response;
            }
        }
    }
    xmlHttp.send(params);
}


function jUpdate(idproduct, idprice, price, money, cntid){

    var xmlHttp = GetXmlHttpObject();
    var params = "idproduct=" + idproduct + "&idprice=" + idprice + "&split=1";
    xmlHttp.open("POST", "/browse/cart/action/add/", true);

    //Send the proper header information along with the request
    xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
    xmlHttp.setRequestHeader("Content-length", params.length);
    xmlHttp.setRequestHeader("Connection", "close");
    xmlHttp.onreadystatechange = function() {
        if (xmlHttp.readyState == 4 && xmlHttp.status == 200) {
            var response = new String(xmlHttp.responseText);
            document.getElementById(idproduct).innerHTML = response;
            var containertxt = response.split("|");

            var cnt = document.getElementById(cntid).value;
            var idop = containertxt[0];
            var idorder = containertxt[1];
            var inner = document.getElementById(idproduct);
	
            if(cnt > 1){
		
                changeProductCount(idop, idorder, cnt);
		
                for(i=1; i<=cnt; i++){
                    updateSidebarCart('1', price, money);
                }
		
            } else {
                updateSidebarCart('1', price, money);
            }
                       
			
            inner.innerHTML = '<a href="/browse/cart/action/basket/" class="ordera" style="width: 210px; \n\
                             height:60px; padding:4px;padding-left:9px; padding-top:0; font-size:13px;  \n\border-radius: 0px 7px 7px 7px;\n\
    -moz-border-radius: 0px 7px 7px 7px;\n\
    -webkit-border-radius: 0px 7px 7px 7px;\n\
                                clear:both; display: block;\n\
                             text-decoration: none;"\n\
                             document.addcart.src=\"/htdocs/images/default/shoping_car12.png\" \' document.addcart.src=\"/htdocs/images/default/shoping_car12.png\" \'><img name="addcart" src="/htdocs/images/default/shoping_car12.png" style="border: none;    float: right;">&nbsp;<br>Маркирани стоки до момента</a>';
                        
        }          
    }
    xmlHttp.send(params);
}



function jUpdate1(idproduct, idprice, price, money, cntid){

    var xmlHttp = GetXmlHttpObject();
    var params = "idproduct=" + idproduct + "&idprice=" + idprice + "&split=1";
    xmlHttp.open("POST", "/browse/cart/action/add/", true);

    //Send the proper header information along with the request
    xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
    xmlHttp.setRequestHeader("Content-length", params.length);
    xmlHttp.setRequestHeader("Connection", "close");
    xmlHttp.onreadystatechange = function() {
        if (xmlHttp.readyState == 4 && xmlHttp.status == 200) {
            var response = new String(xmlHttp.responseText);
            document.getElementById(idproduct).innerHTML = response;
            var containertxt = response.split("|");

            var cnt = document.getElementById(cntid).value;
            var idop = containertxt[0];
            var idorder = containertxt[1];
            var inner = document.getElementById(idproduct);

            if(cnt > 1){

                changeProductCount(idop, idorder, cnt);

                for(i=1; i<=cnt; i++){
                    updateSidebarCart('1', price, money);
                }

            } else {
                updateSidebarCart('1', price, money);
            }



        }
    }
    
    xmlHttp.send(params);

   
    closeLightBox("popupproducts");  

}



function addToCart1(idproduct, idprice, divname, cart_lang){


    var xmlHttp = GetXmlHttpObject();
    
    var params = "idproduct=" + idproduct + "&idprice=" + idprice;
    xmlHttp.open("POST", "/browse/cart/action/add/", true);

    //Send the proper header information along with the request
    xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
    xmlHttp.setRequestHeader("Content-length", params.length);
    xmlHttp.setRequestHeader("Connection", "close");
    xmlHttp.onreadystatechange = function() {
        if (xmlHttp.readyState == 4 && xmlHttp.status == 200) {
            var response = new String(xmlHttp.responseText);
            document.getElementById(divname+"_"+idproduct).innerHTML = "<a href='/browse/cart/action/basket/' class='order'>"+cart_lang+"</a>";
        }
    }
   
    xmlHttp.send(params);
    
}


function changeProductCount(idop, idorder, count, all_price, delivery_price, hour_delivery_price){ 

    var xmlHttp = GetXmlHttpObject();
    var params = "idop=" + idop + "&idorder=" + idorder +"&count=" + count;
    xmlHttp.open("POST", "/browse/cart/action/count/", true);


    //Send the proper header information along with the request
    xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
    xmlHttp.setRequestHeader("Content-length", params.length);
    xmlHttp.setRequestHeader("Connection", "close");
    xmlHttp.onreadystatechange = function() {
        if (xmlHttp.readyState == 4 && xmlHttp.status == 200) {
            var response = new String(xmlHttp.responseText);
            if (all_price) {
                
                
                document.getElementById("all_price").innerHTML = parseFloat(response)+ parseFloat(delivery_price)+ parseFloat(hour_delivery_price);
                
            }
        }
    }
    xmlHttp.send(params);
}

function changeMark(mark){ 

    var xmlHttp = GetXmlHttpObject();
    var params = "mark=" + mark;
    xmlHttp.open("POST", "/browse/mark/name/"+mark, true);

    //Send the proper header information along with the request
    xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
    xmlHttp.setRequestHeader("Content-length", params.length);
    xmlHttp.setRequestHeader("Connection", "close");
    xmlHttp.onreadystatechange = function() {
        if (xmlHttp.readyState == 4 && xmlHttp.status == 200) {
            var response = new String(xmlHttp.responseText);
            document.getElementById("mark").innerHTML = response;
        }
    }
    xmlHttp.send(params);
}


function updateSidebarTown(idorder, town, data){

    var xmlHttp = GetXmlHttpObject();
    var params = "town=" + town + "&idorder=" + idorder +"&data=" + data;
    xmlHttp.open("POST", "/browse/cart/action/settown/", true);

    xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
    xmlHttp.setRequestHeader("Content-length", params.length);
    xmlHttp.setRequestHeader("Connection", "close");
    
    xmlHttp.onreadystatechange = function() {
        if (xmlHttp.readyState == 4 && xmlHttp.status == 200) {
			

            if (town) {
                document.getElementById('grad').innerHTML = town;
            } else {
                document.getElementById('grad').innerHTML = 'Изберете град';
            }
            if (data) {
                document.getElementById('data1').innerHTML = data;
            } else {
                document.getElementById('data1').innerHTML = 'Изберете дата';
            }

        }
    }

	
    xmlHttp.send(params);

}

/* Don't touch - magic */
function updateSidebarTownIndex(idorder, town, data){

    var xmlHttp = GetXmlHttpObject();
    var params = "town=" + town + "&idorder=" + idorder +"&data=" + data;
    xmlHttp.open("POST", "/browse/cart/action/settown/", true);

    xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
    xmlHttp.setRequestHeader("Content-length", params.length);
    xmlHttp.setRequestHeader("Connection", "close");
    
    xmlHttp.onreadystatechange = function() {
        if (xmlHttp.readyState == 4 && xmlHttp.status == 200) {
			

            if (town) {
                document.getElementById('grad').innerHTML = town;
				
            } else {
                document.getElementById('grad').innerHTML = 'Изберете град';
            }
            if (data) {
                document.getElementById('data1').innerHTML = data;
            } else {
                document.getElementById('data1').innerHTML = 'Изберете дата';
            }

            window.location.reload();

        }
    }

	
    xmlHttp.send(params);

}


function updateSidebarTownIndexHour(idorder, town, data, hour, text, text1, zip){

    var xmlHttp = GetXmlHttpObject();
    var params = "town=" + town + "&idorder=" + idorder +"&hour=" + hour +"&data=" + data +"&zip="+zip;
    xmlHttp.open("POST", "/browse/cart/action/settown/", true);

    xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
    xmlHttp.setRequestHeader("Content-length", params.length);
    xmlHttp.setRequestHeader("Connection", "close");

    xmlHttp.onreadystatechange = function() {
        if (xmlHttp.readyState == 4 && xmlHttp.status == 200) {


            if (town) {
                document.getElementById('grad').innerHTML = town;

            } else {
                document.getElementById('grad').innerHTML = text;
            }
            if (data) {
                document.getElementById('data1').innerHTML = data;
            } else {
                document.getElementById('data1').innerHTML = text1;
            }

            

            window.location.reload();

        }
    }


    xmlHttp.send(params);

}


/* Don't touch - magic */
function updateSidebarTownIndexHour1(idorder, town, data, hour, text1, text2, zip){

    var xmlHttp = GetXmlHttpObject();
    var params = "town=" + town + "&idorder=" + idorder +"&hour=" + hour +"&data=" + data + "&zip=" + zip;
    xmlHttp.open("POST", "/browse/cart/action/settown/", true);

    xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
    xmlHttp.setRequestHeader("Content-length", params.length);
    xmlHttp.setRequestHeader("Connection", "close");

    xmlHttp.onreadystatechange = function() {
        if (xmlHttp.readyState == 4 && xmlHttp.status == 200) {
            var response = new String(xmlHttp.responseText);

            if (town) {
                document.getElementById('grad').innerHTML = town;

            } else {
                document.getElementById('grad').innerHTML = 'Изберете град';
            }
            if (data) {
                document.getElementById('data1').innerHTML = data;
            } else {
                document.getElementById('data1').innerHTML = 'Изберете дата';
            }
           
            if(response!=''){
                
            document.getElementById('minimum').innerHTML = '<input type="button" class="normal_button"  style=" float: right;background-color: silver;text-shadow: -1px -1px 0 #CCCCCC; background: silver; border-color: #E2DEDE;" value="ПРИКЛЮЧВАНЕ НА ПОРЪЧКАТА" />';

                
            } else{
             document.getElementById('minimum').innerHTML ='<input type="button" class="normal_button" style="float: right;" onclick="submitOrder(); " value="ПРИКЛЮЧВАНЕ НА ПОРЪЧКАТА" />';
               
            }

            $('expr').innerHTML = response;
        }
    }


    xmlHttp.send(params);

}



/* Don't touch - magic */
function updateSidebarTownIndex1(idorder, town, data, hour){

    var xmlHttp = GetXmlHttpObject();
    var params = "town=" + town + "&idorder=" + idorder +"&data=" + data + "&hour=" + hour;
    xmlHttp.open("POST", "/browse/cart/action/settown/", true);

    xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
    xmlHttp.setRequestHeader("Content-length", params.length);
    xmlHttp.setRequestHeader("Connection", "close");

    xmlHttp.onreadystatechange = function() {
        if (xmlHttp.readyState == 4 && xmlHttp.status == 200) {
            var response = new String(xmlHttp.responseText);

            if (town) {
                document.getElementById('grad').innerHTML = town;

            } else {
                document.getElementById('grad').innerHTML = 'Изберете град';
            }
            if (data) {
                document.getElementById('data1').innerHTML = data;
            } else {
                document.getElementById('data1').innerHTML = 'Изберете дата';
            }

           
            if( (response!='') ){
                var texta = "Моля сменете датата на доставка.";
                document.getElementById('minimum').innerHTML = '<input type="button" class="normal_button" onClick="alert('+texta+');"  style="float: right;background-color: silver;text-shadow: -1px -1px 0 #CCCCCC; background: silver; border-color: #E2DEDE;" value="ПРИКЛЮЧВАНЕ НА ПОРЪЧКАТА" />';
  
            }else{
                
                document.getElementById('minimum').innerHTML ='  <input type="button" class="normal_button" style="float: right;" onclick="submitOrder();" value="ПРИКЛЮЧВАНЕ НА ПОРЪЧКАТА" />';
            }

            $('expr').innerHTML = response;
        }
    }


    xmlHttp.send(params);

}


function chekNoExpres(){

    var xmlHttp = GetXmlHttpObject();
    var params = "";
    xmlHttp.open("POST", "/browse/cart/action/cheknoexpres/", true);

    xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
    xmlHttp.setRequestHeader("Content-length", params.length);
    xmlHttp.setRequestHeader("Connection", "close");

    xmlHttp.onreadystatechange = function() {
        if (xmlHttp.readyState == 4 && xmlHttp.status == 200) {
            var response = new String(xmlHttp.responseText);
            var yes = response.split("|");

            if(yes[0]=="no") {
                $('expr').innerHTML = '';
            }


        }
    }

    xmlHttp.send(params);

}

function chekNoExpresProdukt(date){
    var xmlHttp = GetXmlHttpObject();
    var params = "date="+ date;
    xmlHttp.open("POST", "/browse/cart/action/noexpres/", true);

    xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
    xmlHttp.setRequestHeader("Content-length", params.length);
    xmlHttp.setRequestHeader("Connection", "close");

    xmlHttp.onreadystatechange = function() {
        if (xmlHttp.readyState == 4 && xmlHttp.status == 200) {
            var response = new String(xmlHttp.responseText);

                 
            if(response!='') {
                $('expr').innerHTML = response;


                document.getElementById('no').innerHTML = '<div class="noexpres">Този продукт не може да бъде изпратен с експресна поръчка!</div>';

            }else{

               document.getElementById('no').innerHTML = '';
                         
            }
         
        
        }
    }

    xmlHttp.send(params);
}


function updateSidebarCart(addtotal, addprice){

    var total = document.getElementById('cart_total');
    var price = document.getElementById('cart_sum');
    
    var newtotal;
    var newprice;
	
    newtotal = Number(total.innerHTML)+Number(addtotal);
    newprice = Number(price.innerHTML)+Number(addprice);
    newprice = Math.round(newprice*100) / 100;

    if(newtotal=='1'){
         document.getElementById('info_produkt').innerHTML = '<strong style="color:#666; font-weight: normal;">продукт </style>';
    }else{
        document.getElementById('info_produkt').innerHTML = '<strong style="color:#666; font-weight: normal;">продуктa </style>';
    }


    total.innerHTML = newtotal;
    price.innerHTML = newprice;
   
}


function updateSidebarCart1(addtotal, addprice, min_value){

    var total = document.getElementById('cart_total');
    var price = document.getElementById('cart_sum');
    var minimum = document.getElementById('minimuma');
    var notitem = document.getElementById('notitem');

    var texta = '<b>Минималната стойност на поръчката не може да бъде по-малка от '+ min_value +'лв.</b>';
    var newtotal;
    var newprice;

    newtotal = Number(total.innerHTML)+Number(addtotal);
    newprice = Number(price.innerHTML)+Number(addprice);
    newprice = Math.round(newprice*100) / 100;
    if(newprice<min_value){
            
        minimum.innerHTML = '<a href="javascript:;" onClick="alert('+ texta + ');" class="normal_button" style=" background-color: silver;text-shadow: -1px -1px 0 #CCCCCC; background: silver; border-color: #E2DEDE;">Следваща стъпкa</a>';
        notitem.innerHTML = ' <div class="noitems" id="valueto" style="display:block;">'+ texta +'</div>';
    }else{
        minimum.innerHTML = '<a href="/browse/cart/" class="normal_button" >Следваща стъпкa</a>';
        notitem.innerHTML = ' <div class="noitems" id="valueto" style="display:none;">'+ texta +'</div>';
    }



     if(newtotal=='1'){
         document.getElementById('info_produkt').innerHTML = '<strong style="color:#666; font-weight: normal;">продукт </style>';
    }else{
        document.getElementById('info_produkt').innerHTML = '<strong style="color:#666; font-weight: normal;">продуктa </style>';
    }


    total.innerHTML = newtotal;
    price.innerHTML = newprice;
    
}

function updateSidebarCart2(addtotal, addprice, min_value){

    var total = document.getElementById('cart_total');
    var price = document.getElementById('cart_sum');
    var minimum = document.getElementById('minimum');
    var notitem = document.getElementById('notitem');

    var texta = '<b>Минималната стойност на поръчката не може да бъде по-малка от '+ min_value +'лв.</b>';
    var newtotal;
    var newprice;

    newtotal = Number(total.innerHTML)+Number(addtotal);
    newprice = Number(price.innerHTML)+Number(addprice);
    newprice = Math.round(newprice*100) / 100;

    if(newprice<min_value){

        minimum.innerHTML = '<input type="button" class="normal_button" onClick="alert('+ texta +');"  style="float: right;background-color: silver; float: right;text-shadow: -1px -1px 0 #CCCCCC; background: silver; border-color: #E2DEDE;" value="ПРИКЛЮЧВАНЕ НА ПОРЪЧКАТА" />';
        notitem.innerHTML = ' <div class="noitems" id="valueto" style="display:block;">'+ texta +'</div>';
    }else{
        minimum.innerHTML ='<input type="button" class="normal_button"  style="float: right;"  onclick="submitOrder();" value="ПРИКЛЮЧВАНЕ НА ПОРЪЧКАТА" />';
        notitem.innerHTML = ' <div class="noitems" id="valueto" style="display:none;">'+ texta +'</div>';
    }

      if(newtotal=='1'){
         document.getElementById('info_produkt').innerHTML = '<strong style="color:#666; font-weight: normal;">продукт </style>';
    }else{
        document.getElementById('info_produkt').innerHTML = '<strong style="color:#666; font-weight: normal;">продуктa </style>';
    }

    total.innerHTML = newtotal;
    price.innerHTML = newprice;

}

function updateSidebarCartDecr(addtotal, addprice){

    var total = document.getElementById('cart_total');
    var price = document.getElementById('cart_sum');
    
   
   
    var newtotal;
    var newprice;

    newtotal = Number(total.innerHTML)-Number(addtotal);
    newprice = Number(price.innerHTML)-Number(addprice);
    newprice = Math.round(newprice*100) / 100;
    if(newtotal < 0){
        newtotal = 0;
        newprice = 0;
	
                
    }




    if(newtotal=='1'){
         document.getElementById('info_produkt').innerHTML = '<strong style="color:#666; font-weight: normal;">продукт </strong>';

    }else if(newtotal=='0'){

        document.getElementById('info_produkt').innerHTML = '<strong style="color:#999; font-weight: normal;">продуктa </strong>';
    }else{

       document.getElementById('info_produkt').innerHTML = '<strong style="color:#666; font-weight: normal;">продуктa </strong>';
    }


    total.innerHTML = newtotal;
    price.innerHTML = newprice;
}


function updateSidebarCartDecr1(addtotal, addprice, min_value){

    var total = document.getElementById('cart_total');
    var price = document.getElementById('cart_sum');
    var minimum = document.getElementById('minimuma');
    var notitem = document.getElementById('notitem');
    var texta = '<b>Минималната стойност на поръчката не може да бъде по-малка от '+min_value+'лв.</b>';
    var newtotal;
    var newprice;

    newtotal = Number(total.innerHTML)-Number(addtotal);
    newprice = Number(price.innerHTML)-Number(addprice);
    newprice = Math.round(newprice*100) / 100;
    if(newtotal < 0){
        newtotal = 0;
        newprice = 0;

    }




  if(newtotal=='1'){
         document.getElementById('info_produkt').innerHTML = '<strong style="color:#666; font-weight: normal;">продукт </strong>';

    }else if(newtotal=='0'){

        document.getElementById('info_produkt').innerHTML = '<strong style="color:#999; font-weight: normal;">продуктa </strong>';
    }else{

       document.getElementById('info_produkt').innerHTML = '<strong style="color:#666; font-weight: normal;">продуктa </strong>';
    }

    if(newprice<min_value){

        minimum.innerHTML = '<a href="javascript:;" onClick="alert('+ texta + ');" class="normal_button" style=" background-color: silver;text-shadow: -1px -1px 0 #CCCCCC; background: silver; border-color: #E2DEDE;">Следваща стъпкa</a>';

        notitem.innerHTML = ' <div class="noitems" id="valueto" style="display:block;">'+ texta +'</div>';
    }else{
        minimum.innerHTML = '<a href="/browse/cart/" class="normal_button" >Следваща стъпкa</a>';
        notitem.innerHTML = ' <div class="noitems" id="valueto" style="display:none;">'+ texta +'</div>';
    }

    total.innerHTML = newtotal;
    price.innerHTML = newprice;
}

function updateSidebarCartDecr2(addtotal, addprice, min_value){

    var total = document.getElementById('cart_total');
    var price = document.getElementById('cart_sum');
    var minimum = document.getElementById('minimum');
    var notitem = document.getElementById('notitem');
    var texta = '<b>Минималната стойност на поръчката не може да бъде по-малка от '+min_value+'лв.</b>';
    var newtotal;
    var newprice;

    newtotal = Number(total.innerHTML)-Number(addtotal);
    newprice = Number(price.innerHTML)-Number(addprice);
    newprice = Math.round(newprice*100) / 100;
    if(newtotal < 0){
        newtotal = 0;
        newprice = 0;


    }

    


    if(newprice<min_value){

        minimum.innerHTML = '<input type="button" class="normal_button" onClick="alert('+ texta +');"  style="float: right; background-color: silver;text-shadow: -1px -1px 0 #CCCCCC; background: silver; border-color: #E2DEDE;" value="ПРИКЛЮЧВАНЕ НА ПОРЪЧКАТА" />';
        notitem.innerHTML = ' <div class="noitems" id="valueto" style="display:block;">'+ texta +'</div>';
    }else{
        minimum.innerHTML ='<input type="button" class="normal_button" style="float: right;" onclick="submitOrder();" value="ПРИКЛЮЧВАНЕ НА ПОРЪЧКАТА" />';
        notitem.innerHTML = ' <div class="noitems" id="valueto" style="display:none;">'+ texta +'</div>';
    }


 if(newtotal=='1'){
         document.getElementById('info_produkt').innerHTML = '<strong style="color:#666; font-weight: normal;">продукт </strong>';

    }else if(newtotal=='0'){

        document.getElementById('info_produkt').innerHTML = '<strong style="color:#999; font-weight: normal;">продуктa </strong>';
    }else{

       document.getElementById('info_produkt').innerHTML = '<strong style="color:#666; font-weight: normal;">продуктa </strong>';
    }


    total.innerHTML = newtotal;
    price.innerHTML = newprice;
}
function emp(id){
    var val = document.getElementById(id).value;
    var bval = document.getElementById('b'+id).value;
	
    document.getElementById('b'+id).value = val;
    document.getElementById(id).value = '';
}

function re(id){
	
    var val = document.getElementById(id).value;
    var bval = document.getElementById('b'+id).value;
	
    if(val == '' || val == '0')
        document.getElementById(id).value = bval;
}

function incr2(id, item, tot){
    var pcnt = document.getElementById(id);
    var pcntval = document.getElementById(id).value;
    var calc = 0;
	
    pcnt.value = (Number(pcntval)+1);

    calc = pcnt.value * document.getElementById(item).innerHTML;
    document.getElementById(tot).innerHTML = calc.toFixed(2);
}

function decr2(id, item, tot){
	
    var pcnt = document.getElementById(id);
    var pcntval = document.getElementById(id).value;
    var calc = 0;
	
    pcnt.value = (Number(pcntval)-1);
    if(pcnt.value < 1){
        pcnt.value = 1;
        document.getElementById('cart_total')=1;
        document.getElementById('cart_sum')=tot;

    }
        
    calc = pcnt.value * document.getElementById(item).innerHTML;
    document.getElementById(tot).innerHTML = calc.toFixed(2);
}

function deleteFromCart(idop, idorder, all_price){ 
    var xmlHttp = GetXmlHttpObject();
    var params = "idop=" + idop + "&idorder=" + idorder;
    xmlHttp.open("POST", "/browse/cart/action/delete/", true);
    //Send the proper header information along with the request
    xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
    xmlHttp.setRequestHeader("Content-length", params.length);
    xmlHttp.setRequestHeader("Connection", "close");
    xmlHttp.onreadystatechange = function() {
        if (xmlHttp.readyState == 4 && xmlHttp.status == 200) {
            var response = new String(xmlHttp.responseText);
            //document.getElementById(idop).innerHTML = "";
            if(response == 0) {
                //document.getElementById("whole_cart").innerHTML = "<div class=\"boxProductContent\" align=\"center\" style=\"padding-top: 10px;\"><b>��������� � ������</b><br><br></div><br></td></tr>";
                //document.getElementById("asd").innerHTML = "";
                window.location.reload();
            }
            if (all_price) {
                document.getElementById("all_price").innerHTML = response;
            }
        }
    }
    xmlHttp.send(params);
}

function hideTown(){
    document.getElementById('grad').innerHTML = '';
    document.getElementById('data1').innerHTML = '';
    
}

function removeRow(id) {

        
    var tr = document.getElementById(id);
    if (tr) {
        if (tr.nodeName == 'TR') {
            var tbl = tr; // Look up the hierarchy for TABLE
            while (tbl != document && tbl.nodeName != 'TABLE') {
                tbl = tbl.parentNode;

                               
            }

            if (tbl && tbl.nodeName == 'TABLE') {
                while (tr.hasChildNodes()) {
                    tr.removeChild( tr.lastChild );
                                       
                }
                tr.parentNode.removeChild( tr );

                                
            }
        } else {
            alert( 'Specified document element is not a TR. id=' + id );
                        
        }
    } else {
       

               
}
}



function addRow(tableid, info){

    if (document.getElementById('check_' + info[0]).checked == true) {

        var piece = info[4].split("&nbsp;");
        updateSidebarCart('1', piece[0]);

        var tbody = document.getElementById(tableid).getElementsByTagName("TBODY")[0];
        var row = document.createElement("TR");
        row.setAttribute('class', 'moreprods');
        row.setAttribute('id', 'x_'+info[0]);

        var td1 = document.createElement("TD");
        td1.innerHTML = "<a href='"+info[1]+"'><img src='"+info[2]+"' height='39' width='39' alt='"+info[3]+"' /></a>";

        var td2 = document.createElement("TD");
        td2.innerHTML = "<a href='"+info[1]+"'><h3 style='text-transform: uppercase;'>"+info[3]+"</h3></a><small>Допълнително към поръчката</small>";

        var td3 = document.createElement("TD");
        td3.setAttribute('align', 'center');
        td3.innerHTML = "<strong><span>1</span> бр.</strong>";

        var td4 = document.createElement("TD");
        td4.setAttribute('align', 'right');
        td4.innerHTML = "<strong>"+info[4]+"</strong>";

        var td5 = document.createElement("TD");
        td5.setAttribute('align', 'right');
        td5.innerHTML = "<strong>"+info[4]+"</strong>";

        var td6 = document.createElement("TD");
        td6.setAttribute('align', 'center');
        td6.innerHTML = "<input type='hidden' name='del_"+info[0]+"' id='del_"+info[0]+"' value='' /><a href='javascript:;' class='deleteico' title='Изтрий артикула от кошницата' onclick='deleteFromCart(document.getElementById(\"del_" + info[0] + "\").value, "+info[6]+", 0); updateSidebarCartDecr(1, "+piece[0]+"); removeRow(\"x_"+info[0]+"\"); document.getElementById(\"label_"+info[0]+"\").className = \"element\"; document.getElementById(\"check_"+info[0]+"\").checked = false;'></a>";
        //td6.innerHTML = "<input type='hidden' name='del_"+info[0]+"' id='del_"+info[0]+"' value='' /><a href='javascript:;' class='deleteico' title='Изтрий артикула от кошницата' onclick='addRow(\"productTable\", arr["+info[0]+"]);'></a>";

        row.appendChild(td1);
        row.appendChild(td2);
        row.appendChild(td3);
        row.appendChild(td4);
        row.appendChild(td5);
        row.appendChild(td6);
        tbody.appendChild(row);
        document.getElementById('label_' + info[0]).className = 'element checkedelement';
        addToCart(info[0], info[5], 1);
        if (info[7])
            document.getElementById('card_text').style.display = 'block';
    } else {
        document.getElementById('label_' + info[0]).className = 'element';
        var piece = info[4].split("&nbsp;");
        updateSidebarCartDecr('1', piece[0]);
        deleteFromCart(document.getElementById('del_'+info[0]).value, info[6], 0);
        removeRow('x_'+info[0]);
        if (info[7])
            document.getElementById('card_text').style.display = 'none';
    }
}


function addRow1(tableid, idop, idorder,  pricevalue,  url, img, altimg){
	
        
	
    var tbody = document.getElementById(tableid).getElementsByTagName("TBODY")[0];
    var row = document.createElement("TR");
        
    row.setAttribute('id', idop);
		
    var td1 = document.createElement("TD");
    td1.innerHTML = "<a href='"+url+"'><img src='"+img+"' height='39' width='39' alt='"+altimg+"' /></a>";
		
    var td2 = document.createElement("TD");
    td2.innerHTML = "<a href='"+url+"'><h3 style='text-transform: uppercase;'>"+altimg+"</h3></a><small>Допълнително към поръчката</small>";
		
    var td3 = document.createElement("TD");
    td3.setAttribute('id', 'center');
    td3.innerHTML = "<strong><span>1</span> бр.</strong>";
		
    var td4 = document.createElement("TD");
    td4.setAttribute('id', "prod_item_"+idop);
    td4.innerHTML = "<strong>"+pricevalue+"</strong>";
		
    var td5 = document.createElement("TD");
    td5.setAttribute('id', "prod_total_"+idop);
    td5.innerHTML = "<strong>"+pricevalue+"</strong>";
		
    var td6 = document.createElement("TD");
        
    td6.innerHTML = "<a href='javascript:;' class='deleteico' title='Изтрий артикула от кошницата' onclick='  removeRow(document.getElementById("+idop+").value); '></a>";
    //td6.innerHTML = "<input type='hidden' name='del_"+info[0]+"' id='del_"+info[0]+"' value='' /><a href='javascript:;' class='deleteico' title='Изтрий артикула от кошницата' onclick='addRow(\"productTable\", arr["+info[0]+"]);'></a>";
		
    row.appendChild(td1);
    row.appendChild(td2);
    row.appendChild(td3);
    row.appendChild(td4);
    row.appendChild(td5);
    row.appendChild(td6);
    tbody.appendChild(row);
        
   
}

function addAdditional(info){
	
    if (document.getElementById('check_' + info[0]).checked == true) {
		

        var piece = info[1].split("&nbsp;");
        updateSidebarCart('1', piece[0]);
		
        document.getElementById('label_' + info[0]).className = 'element checkedelement';
        addToCart(info[0], info[2], 2);
		
        if (info[3]){
            document.getElementById('card_text').style.display = 'block';
            document.getElementById('card_chois').style.display = 'block';
        }
		
    } else {
        document.getElementById('label_' + info[0]).className = 'element';
		
        var piece = info[1].split("&nbsp;");
        updateSidebarCartDecr('1', piece[0]);
		
        var del = document.getElementById('del_'+info[0]).value;
        var delpiece = del.split(":");
        deleteFromCart(delpiece[0], delpiece[1], 0);
		
        if (info[3]){
            document.getElementById('card_text').style.display = 'none';
            document.getElementById('card_chois').style.display = 'none';
        }
    }
}

function updateAllPrice() {
	
    var ischecked = document.getElementById('stoday').checked;
    var isused = document.getElementById('isused');
    var all_price = document.getElementById('all_price');
    var new_price = 0;
	
    if (ischecked == true && isused.value == 'ondate') {
        new_price = (Number(all_price.innerHTML) * 1.25);
        all_price.innerHTML = new_price.toFixed(2);
        isused.value = 'today';
        var now = new Date();
        var xd = now.getDate();
        if (xd < 10) {
            xd = '0'+xd;
        }
        document.getElementById('sentdate').value = xd + '.' + (Number(now.getMonth()) + 1) + '.' + now.getFullYear();
    } else if (ischecked == false && isused.value == 'today') {
        new_price = (Number(all_price.innerHTML) / 1.25);
        all_price.innerHTML = new_price.toFixed(2);
        isused.value = 'ondate';
        document.getElementById('sentdate').value = '';
    }
}

function saveCardText(idorder, text){ 

    var xmlHttp = GetXmlHttpObject();
    var params = "idorder=" + idorder +"&text=" + text;
    xmlHttp.open("POST", "/browse/cart/action/saveCardText/", true);

    //Send the proper header information along with the request
    xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
    xmlHttp.setRequestHeader("Content-length", params.length);
    xmlHttp.setRequestHeader("Connection", "close");
    xmlHttp.onreadystatechange = function() {
        if (xmlHttp.readyState == 4 && xmlHttp.status == 200) {
    //var response = new String(xmlHttp.responseText);
    }
    }
    xmlHttp.send(params);
}

function saveCardTextProduct(text){ 
	
    var del = document.getElementById('txtarea').value;
    var delpiece = del.split(":");
    var idorder = delpiece[1];
    //alert(del+" "+idorder);

    var xmlHttp = GetXmlHttpObject();
    var params = "idorder=" + idorder +"&text=" + text;
    xmlHttp.open("POST", "/browse/cart/action/saveCardText/", true);

    //Send the proper header information along with the request
    xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
    xmlHttp.setRequestHeader("Content-length", params.length);
    xmlHttp.setRequestHeader("Connection", "close");
    xmlHttp.onreadystatechange = function() {
        if (xmlHttp.readyState == 4 && xmlHttp.status == 200) {
    //var response = new String(xmlHttp.responseText);
    }
    }
    xmlHttp.send(params);
}

function submitOrder() {


    
     var city = document.getElementById('grad').innerHTML;
    var phone = document.getElementById('phonee').value;
    var address = document.getElementById('addresss').value;
    var name = document.getElementById('receiverr').value;
    var sentdate = document.getElementById('sentdate1').value;
    var p2 = document.getElementById('p2').checked;
    var p3 = document.getElementById('p3').checked;
    var p4 = document.getElementById('p4').checked;
    var p5 = document.getElementById('p5').checked;
	
    var xdate = sentdate.split(".");
    var myDate = new Date(xdate[2], (xdate[1]-1), xdate[0]);
    var wdDate = new Date();
    var today = new Date(wdDate.getFullYear(), wdDate.getMonth(), wdDate.getDate());
    //alert(myDate+"\n"+today);
    //alert(city.length()); alert(zip.length()); alert(address.length()); alert(name.length()); alert(sentdate.length());
    //return;
    if (city == '' ||  address == '' || name == '' || phone == '') {
        alert('Всички полета отбелязани със * са задължителни!');
    } else if (sentdate == '') {
        alert('Не сте задали дата за доставка!');
    }else if (phone == '') {
        alert('Моля въведете телефон на получателя!');
    } else if (!isValidDate(sentdate)) {
        alert('Датата на доставка не е валидна (ДД.ММ.ГГГГ)!');
    } else if (today > myDate) {
        alert('Датата на доставка НЕ може да бъде в миналото!');
    } else if (p2 != true && p3 != true && p4 != true && p5 != true) {
        alert('Моля изберете начин за плащане!');
    } else {
        document.orderform.submit();
    }
}


function submitOrder1() {



     var city = document.getElementById('grad').innerHTML;
    var phone = document.getElementById('phonee').value;
    var address = document.getElementById('addresss').value;
    var name = document.getElementById('receiverr').value;
    var sentdate = document.getElementById('sentdate1').value;
    var p2 = document.getElementById('p2').checked;
    var p3 = document.getElementById('p3').checked;
    var p4 = document.getElementById('p4').checked;
    var p5 = document.getElementById('p5').checked;

    var xdate = sentdate.split(".");
    var myDate = new Date(xdate[2], (xdate[1]-1), xdate[0]);
    var wdDate = new Date();
    var today = new Date(wdDate.getFullYear(), wdDate.getMonth(), wdDate.getDate());

   var day_now = wdDate.getDate();
   var hor_now = wdDate.getHours();


if(day_now<10){
  var  day_now = '0'+day_now;
}
    
    if(day_now == xdate[0] ){

        alert(wdDate.getHours());

    }
   
        
    
    //alert(myDate+"\n"+today);
    //alert(city.length()); alert(zip.length()); alert(address.length()); alert(name.length()); alert(sentdate.length());
    //return;
    if (city == '' ||  address == '' || name == '' || phone == '') {
        alert('Всички полета отбелязани със * са задължителни!');
    } else if (sentdate == '') {
        alert('Не сте задали дата за доставка!');
    }else if (phone == '') {
        alert('Моля въведете телефон на получателя!');
    } else if (!isValidDate(sentdate)) {
        alert('Датата на доставка не е валидна (ДД.ММ.ГГГГ)!');
    } else if (today > myDate) {
        alert('Датата на доставка НЕ може да бъде в миналото!');
    } else if (p2 != true && p3 != true && p4 != true && p5 != true) {
        alert('Моля изберете начин за плащане!');
    } else {
       // document.orderform.submit();
    }
}



function checkRegisterEditForm() {


    if($("register_phone").value == ""){
        alert("Не сте въвели телефон");
        return false;
    }
    else if($("register_password").value == ""){
        alert("Не сте въвели парола");
        return false;
    }else if($("register_password2").value == ""){
        alert("Моля повторете паролата");
        return false;
    }else if($("register_password").value != $("register_password2").value){
        alert("Паролите не съвпадат");
        return false;
    }else{

        document.register.submit();

    }



}

function isValidDate(s) {
    // format D(D)/M(M)/(YY)YY
    var dateFormat = /^\d{1,2}[\.]\d{1,2}[\.]\d{1,4}$/;

    if (dateFormat.test(s)) {
        // remove any leading zeros from date values
        s = s.replace(/0*(\d*)/gi,"$1");
        var dateArray = s.split(/[\.]/);
		
        // correct month value
        dateArray[1] = dateArray[1]-1;
		
        // correct year value
        if (dateArray[2].length<4) {
            // correct year value
            dateArray[2] = (parseInt(dateArray[2]) < 50) ? 2000 + parseInt(dateArray[2]) : 1900 + parseInt(dateArray[2]);
        }
		
        var testDate = new Date(dateArray[2], dateArray[1], dateArray[0]);
        if (testDate.getDate()!=dateArray[0] || testDate.getMonth()!=dateArray[1] || testDate.getFullYear()!=dateArray[2]) {
            return false;
        } else {
            return true;
        }
    } else {
        return false;
    }
}



function getIdProduct(idproduct){
    var url = '/browse/getidproducts/idproduct/'+idproduct;

    new Ajax.Request(url,
    {
        method:'post',
        onSuccess: function(transport){
             var resp = transport.responseText;
             var params = resp.split("|");

            $('wait').value = params[0];
        },
        onFailure: function(){ }
    }
    );
}



function addEmailWaiting(email, idproduct){
     var xmlHttp = GetXmlHttpObject();

    var params = "idproduct="+ idproduct +"&email="+ email;
    xmlHttp.open("POST", "/browse/addEmailWaiting/", true);

    //Send the proper header information along with the request
    xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
    xmlHttp.setRequestHeader("Content-length", params.length);
    xmlHttp.setRequestHeader("Connection", "close");
    xmlHttp.onreadystatechange = function() {
        if (xmlHttp.readyState == 4 && xmlHttp.status == 200) {


    }
    }

    xmlHttp.send(params);
}

function fillPopupProducts(idcategory){

    var url = '/browse/addonproducts/idcategory/'+idcategory;

    new Ajax.Request(url,
    {
        method:'post',
        onSuccess: function(transport){
            var html = transport.responseText;
            $('addonproducts').innerHTML = html;
        },
        onFailure: function(){ }
    }
    );
}

function fillPopupProducts1(idcategory){

    var url = '/browse/addonproducts1/idcategory/'+idcategory;

    new Ajax.Request(url,
    {
        method:'post',
        onSuccess: function(transport){
            var html = transport.responseText;
            $('addonproducts').innerHTML = html;
        },
        onFailure: function(){ }
    }
    );
}

function fillPopupProducts2(idcategory){

    var url = '/browse/addonproducts2/idcategory/'+idcategory;

    new Ajax.Request(url,
    {
        method:'post',
        onSuccess: function(transport){
            var html = transport.responseText;
            $('addonproducts').innerHTML = html;
        },
        onFailure: function(){ }
    }
    );
}


function refreshAddonProducts(){
    var url = '/browse/addonproductsselected/';

    new Ajax.Request(url,
    {
        method:'post',
        onSuccess: function(transport){
            var html = transport.responseText;
            $('addon_products_selected').innerHTML = html;
        },
        onFailure: function(){ }
    }
    );
}





function removeAddonProduct(idproduct, idorder){
    var url = '/browse/removeaddonproduct/idproduct/' + idproduct + '/idorder/'+idorder;

    new Ajax.Request(url,
    {
        method:'post',
        onSuccess: function(transport){
			
            var total_count = document.getElementById("cart_total").innerHTML;
            if(parseInt(total_count)!=0){
                document.getElementById("cart_total").innerHTML = parseInt(total_count) - 1;
            }
				
            var total_price = document.getElementById("cart_sum").innerHTML;
            var product_price = document.getElementById("addon_price_" + idproduct).value;
            if(parseInt(total_price)!=0){
                var price = total_price - product_price;
                var sum =  Math.round(price*100) / 100;
                document.getElementById("cart_sum").innerHTML = sum;
            }
				
            document.getElementById('addon_product_selected_'+idproduct).style.display = "none";
				
            if(parseInt(transport.responseText) == "0"){
                $('addon_products_selected').innerHTML = "";
            }
				
				
        },
        onFailure: function(){ }
    }
    );
}


function changeAddonCount(idproduct, idorder, count){

    if(count >= 1){

        var url = '/browse/changeCountAddonProduct/idproduct/' + idproduct + '/idorder/'+idorder + "/count/"+count;
		
        new Ajax.Request(url, {
            method:'post',
            onSuccess: function(transport){
			
                var resp = transport.responseText;
                var params = resp.split("|");

                document.getElementById("cart_total").innerHTML = params[0];
                document.getElementById("cart_sum").innerHTML = params[1];
				
            },
            onFailure: function(){ }
        });
		
    }
}


function refresh_basket(url){
    setTimeout("location.href="+url, 100)
    setTimeout(function(){
        window.location.href=url;
    },100);


}




function refresh1(link) {
    
    window.location=(link);
  
}


function saveValue(field, value, idorder, iduser){


    var xmlHttp = GetXmlHttpObject();

    var params = "idorder="+ idorder +"&field="+ field +"&iduser="+ iduser +"&value="+ value;
    xmlHttp.open("POST", "/index/updateInfo/", true);

    //Send the proper header information along with the request
    xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
    xmlHttp.setRequestHeader("Content-length", params.length);
    xmlHttp.setRequestHeader("Connection", "close");
    xmlHttp.onreadystatechange = function() {
        if (xmlHttp.readyState == 4 && xmlHttp.status == 200) {
				

                                

    }
    }

    xmlHttp.send(params);

}



function updateCardText(idproduct, idorder, text){


    var xmlHttp = GetXmlHttpObject();

    var params = "idproduct="+ idproduct +"&idorder="+idorder +"&text="+ text;
    xmlHttp.open("POST", "/browse/updateCardText/", true);

    //Send the proper header information along with the request
    xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
    xmlHttp.setRequestHeader("Content-length", params.length);
    xmlHttp.setRequestHeader("Connection", "close");
    xmlHttp.onreadystatechange = function() {
        if (xmlHttp.readyState == 4 && xmlHttp.status == 200) {
            showHide("text_"+idproduct);
        }
    }

    xmlHttp.send(params);

}


function updateCardTextIncart(idproduct, idorder, text){


    var xmlHttp = GetXmlHttpObject();

    var params = "idproduct="+ idproduct +"&idorder="+idorder +"&text="+ text;
    xmlHttp.open("POST", "/browse/updateCardText/", true);

    //Send the proper header information along with the request
    xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
    xmlHttp.setRequestHeader("Content-length", params.length);
    xmlHttp.setRequestHeader("Connection", "close");
    xmlHttp.onreadystatechange = function() {
        if (xmlHttp.readyState == 4 && xmlHttp.status == 200) {
            document.location.reload();
        }
    }

    xmlHttp.send(params);

}

function refreshPage(){
     
    setTimeout(function(){
        window.location.reload();
    },100);

}


function  checkHour(date){

   var xmlHttp = GetXmlHttpObject();

    var params = "datata="+ date;
    xmlHttp.open("POST", "/index/chekHour/", true);

    //Send the proper header information along with the request
    xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
    xmlHttp.setRequestHeader("Content-length", params.length);
    xmlHttp.setRequestHeader("Connection", "close");
    xmlHttp.onreadystatechange = function() {
        if (xmlHttp.readyState == 4 && xmlHttp.status == 200) {
            var response = new String(xmlHttp.responseText);
                
                document.getElementById("hoo").innerHTML = response;
            

        }
    }

    xmlHttp.send(params);

}


function  checkHourLimit(date, idorder){

   var xmlHttp = GetXmlHttpObject();

    var params = "datata="+ date+ "&idorder="+idorder;
    xmlHttp.open("POST", "/index/chekHourLast/", true);

    //Send the proper header information along with the request
    xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
    xmlHttp.setRequestHeader("Content-length", params.length);
    xmlHttp.setRequestHeader("Connection", "close");
    xmlHttp.onreadystatechange = function() {
        if (xmlHttp.readyState == 4 && xmlHttp.status == 200) {
            var response = new String(xmlHttp.responseText);

         
                document.getElementById("hoo").innerHTML = response;
                document.getElementById("hours_delivery").innerHTML = '';
                document.getElementById("hours_delivery_price").innerHTML = '';

        }
    }

    xmlHttp.send(params);

}



    function incr(){
        var pcnt = document.getElementById('pcnt');
        var pcntval = document.getElementById('pcnt').value;
	
        pcnt.value = (Number(pcntval)+1);
    }

    function decr(){
        var pcnt = document.getElementById('pcnt');
        var pcntval = document.getElementById('pcnt').value;
	
        pcnt.value = (Number(pcntval)-1);
        if (pcnt.value < 1){
            pcnt.value = 1;
        }
    }
    
    
    window.onload = function(){
	var wdlDate = new Date();
	var xds = wdlDate.getDate();
	
	if (xds < 10) {
		xds = '0'+xds;
	}
	

}


function showPic (whichpic, url) {
		if (document.getElementById) {
                   
			document.getElementById('placeholder').src = whichpic.src;
			document.getElementById('link').href = url;


		} 
}
