// JavaScript Document
function popupWindow(url) {
     window.open(url,'_blank','scrollbars=yes,status=no,width=410,height=450,resizable=no');
}

function popupWindowResizeable(url) {
     window.open(url,'_blank','scrollbars=yes,status=no,width=600,height=400,resizable=yes');
}


function setCookie(name, value)
         {
         //If name is the empty string, it places a ; at the beginning
         //of document.cookie, causing clearCookies() to malfunction.
         if(name != '')
            document.cookie = name + '=' + value;
         }

function getCookie(name)
         {
         //Without this, it will return the first value 
         //in document.cookie when name is the empty string.
         if(name == '')
            return('');
         
         name_index = document.cookie.indexOf(name + '=');
         
         if(name_index == -1)
            return('');
         
         cookie_value =  document.cookie.substr(name_index + name.length + 1, 
                                                document.cookie.length);
         
         //All cookie name-value pairs end with a semi-colon, except the last one.
         end_of_cookie = cookie_value.indexOf(';');
         if(end_of_cookie != -1)
            cookie_value = cookie_value.substr(0, end_of_cookie);

         //Restores all the blank spaces.
         space = cookie_value.indexOf('+');
         while(space != -1)
              { 
              cookie_value = cookie_value.substr(0, space) + ' ' + 
              cookie_value.substr(space + 1, cookie_value.length);
							 
              space = cookie_value.indexOf('+');
              }

         return(cookie_value);
         }



function clearCookie(name)
         {                  
         expires = new Date();
         expires.setYear(expires.getYear() - 1);

         document.cookie = name + '=' + null + '; expires=' + expires; 		 
         }


function logout (cookiename)         
         {
           clearCookie(cookiename);
           location.href='/';

         }  

function clearCookies()
         {
         Cookies = document.cookie;
         Cookie = Cookies;
         expires = new Date();
         expires.setYear(expires.getYear() - 1);

         while(Cookie.length > 0)
              {
              //All cookie name-value pairs end with a semi-colon, except the last one.
              Cookie = Cookies.substr(0, Cookies.indexOf(';'));
              Cookies = Cookies.substr(Cookies.indexOf(';') + 1, Cookies.length);

              if(Cookie != '')
                 document.cookie = Cookie + '; expires=' + expires;
              else
                 document.cookie = Cookies + '; expires=' + expires;			  			  	  
              }		 		 
         }

function openBrWindow(theURL,winName,features) {
  window.open(theURL,winName,features);
}


function submit_SubOrder_firstver(u, volum) {
          var url1 = u + "&" +volum.name+"="+volum.value;
         
          document.returnValue = false;
          
          if ( (volum.value.length == 0) ||  (volum.value == 0) ) {
           window.alert("Δεν έχει εισαχθεί ποοσότητα. Παρακαλούμε συμπληρώστε το πεδίο της Ποσότητας");
	  
		  }
	  else {	  
           window.location.href=url1;
          } 
        }

function submit_SubOrder(u, volum,box) {
          var url1 = u + "&" +volum.name+"="+volum.value;
         
          document.returnValue = false;
          
          if ( (volum.value.length == 0) ||  (volum.value == 0) ) {
           window.alert("Δεν έχει εισαχθεί ποοσότητα. Παρακαλούμε συμπληρώστε το πεδίο της Ποσότητας");
	  
		  }
	  else {	  
            if (box > 1) { 
                 if ( (volum.value % box) > 0 ) {
                    window.alert("Η ποσότητα παραγγελίας θα πρέπει να είναι πολλαπλάσια του " + box);
                 }
                 else { 
                    window.location.href=url1; 
                 }
            }
            else
             window.location.href=url1;
          } 

function Check_Quan(volume,box) {

            if (box > 1) { 
                 if ( (volume.value % box) > 0 ) {
                    window.alert("Η ποσότητα παραγγελίας θα πρέπει να είναι πολλαπλάσια του " + box);
                    return false;
                 }
	    }
	
}

}

