function checkrequired(which) {
var pass=true;
if (document.images) {
for (i=0;i<which.length;i++) {
var tempobj=which.elements[i];
if (tempobj.name.substring(0,3)=="req") {
if (((tempobj.type=="text"||tempobj.type=="textarea"||tempobj.type=="password")&&
tempobj.value=='')||(tempobj.type.toString().charAt(0)=="s"&&
tempobj.selectedIndex==0)) {
pass=false;
break;
         }
      }
   }
}
if (!pass) {
shortFieldName=tempobj.name.substring(8,30).toLowerCase();
alert("Παρακαλώ συμπληρώστε τα πεδία με αστερίσκο (*)");
return false;
}
else
return true;
}

function refresh()
{
    window.location.reload( false );
}

function checkAll(field)
{
for (i = 0; i < field.length; i++)
	field[i].checked = true ;
}

function uncheckAll(field)
{
for (i = 0; i < field.length; i++)
	field[i].checked = false ;
}

/* SUBMIT DISABLER */
var submitted = 0;
function LockButton (form,fld) {
   if ( ! submitted ) { 
	   form.fld[element].disabled=true;
	   submitted = 1;
	   form.submit;
   }
   else { alert("Form already submitted, please be patient"); }
}

function Start(URL, WIDTH, HEIGHT) {
windowprops = "left=50,top=50,width=" + WIDTH + ",height=" + HEIGHT;
preview = window.open(URL, "preview", windowprops);
// if (closetime) setTimeout("preview.close();", closetime*1000);
}


function go(field) 
{
location=field.value
}

function myopen(popupurl)
{
    popupWindow=open(popupurl,'windowName','scrollbars=yes,resizable=no,width=550,height=480');
    if (popupWindow.opener == null) popupWindow.opener = self;
}
		
function NewWindow(mypage, myname, w, h, scroll) 
{ 	var winl = (screen.width - w) / 2;
	var wint = (screen.height - h) / 2;
	winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+', scrollbars='+scroll+', resizable'
	win = window.open(mypage, myname, winprops)

	if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); 
}
}

pos = 9999;
for(num=0;num<document.links.length;num++) {
if (document.links[num].href.indexOf("updatelink") != -1) {
pos = num;
num = 5000;
   }
}
function update() {
if (pos!=9999) {
sel = document.addresses.list.selectedIndex;
document.links[pos].href = document.addresses.list[sel].value;
   }
}
update();

/*
<textarea name=message wrap=physical cols=28 rows=4 onKeyDown="textCounter(this.form.message,this.form.remLen,125);" onKeyUp="textCounter(this.form.message,this.form.remLen,125);"></textarea>
<br>
<input readonly type=text name=remLen size=3 maxlength=3 value="125"> characters left
*/
function textCounter(field, countfield, maxlimit) {
if (field.value.length > maxlimit)
field.value = field.value.substring(0, maxlimit);
else 
countfield.value = maxlimit - field.value.length;
}

function placeFocus() {
if (document.forms.length > 0) {
var field = document.forms[0];
for (i = 0; i < field.length; i++) {
if ((field.elements[i].type == "text") || (field.elements[i].type == "textarea")) {
document.forms[0].elements[i].focus();
break;
         }
      }
   }
}

function submitForm(s)  {
s.value = "  Επεξεργασία...  ";
return true;
}

function clear_textbox(fld)
{
if (fld.value == "Αλλαγή")
fld.value = "";
} 

function drawAlert(alertMsg)
{
alert (alertMsg);
}

function PrintThisPage() 
{ 
   var sOption="toolbar=yes,location=no,directories=yes,menubar=yes,scrollbars=yes,width=770,height=600,left=100,top=25"; 

   var sWinHTML = document.getElementById('print').innerHTML; 
   
   var winprint=window.open("","",sOption); 
		winprint.document.open(); 
		winprint.document.write('<html>'); 
		winprint.document.write('	<head>');
		winprint.document.write('	<title>Εκτύπωση Σελίδας</title>'); 
		winprint.document.write('		<link href="include/cssfile.css" rel="Stylesheet" media="screen">'); 
		winprint.document.write('		<link href="include/pcssfile.css" rel="Stylesheet" media="print">');
		winprint.document.write('	</head>'); 
		winprint.document.write('	<body>');
		winprint.document.write(sWinHTML);          
		winprint.document.write('	</body>'); 
		winprint.document.write('</html>'); 
		winprint.document.close(); 
		winprint.focus(); 
}


function selColor(productid) {
	popupWindow=open('colors.asp?product=' + productid,'selColorPopup','scrollbars=yes,resizable=no,width=250,height=155');
	if (popupWindow.opener == null) popupWindow.opener = self;
}
function selSize(productid) {
	popupWindow=open('sizes.asp?product=' + productid,'selSizePopup','scrollbars=yes,resizable=no,width=250,height=155');
	if (popupWindow.opener == null) popupWindow.opener = self;
}			
function selColorSize(productid) {
	popupWindow=open('colorsize.asp?product=' + productid,'windowName','scrollbars=yes,resizable=no,width=250,height=155');
	if (popupWindow.opener == null) popupWindow.opener = self;
}		

function selectivecheck(field, myselection)
    {
      var fieldid;
      var pos;
      var criteria;
      var strng;
      strng = myselection.value;
      for (i=0; i<field.length; i++)
        {
          if (strng=="all")
            {
            field[i].checked = true;
            }
          else
            {
              fieldid = field[i].id;
              pos = strng.substring(0,1);
              criteria = strng.substring(1,2);  //this gets the information we want to evaluate
              if (fieldid.substring(pos,pos+1)==criteria)
                {
                  field[i].checked = true;
                }
              else
                {
                  field[i].checked = false; //you could leave this out if you don't want to clear the check boxes
                }
            }
        }
    }

function ToggleInput(check, txtBox)
{
	var txt = document.getElementById(txtBox);
	txt.disabled = !(check.checked);
}