function popuponload(weblink){
			var	theHeight=480;
			var	theWidth=640;
			var theTop=(screen.height/2)-(theHeight/2);
			var theLeft=(screen.width/2)-(theWidth/2);
			var features='height='+theHeight+',width='+theWidth+',top='+theTop+',left='+theLeft+",scrollbars=yes";
			theWin=window.open(weblink+'popup.php','',features);
}


function change_Main(url,theWidth,theHeight){
var theTop=(screen.height/2)-(theHeight/2);
var theLeft=(screen.width/2)-(theWidth/2);
var features=
'height='+theHeight+',width='+theWidth+',top='+theTop+',left='+theLeft+",scrollbars=yes";
theWin=window.open(url,'',features);
}



function pic_open(imageType,imageName,imageWidth,imageHeight,alt,posLeft,posTop) {  // v4.01

	newWindow = window.open("","newWindow","width="+imageWidth+",height="+imageHeight+",scrollbars=no,left="+posLeft+",top="+posTop);
	newWindow.document.open();
	newWindow.document.write('<html><title>'+alt+'</title><body bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginheight="0" marginwidth="0" onBlur="self.close()">');
	newWindow.document.write('<img src=\"'+imageName+'\" width='+imageWidth+' height='+imageHeight+' alt=\"'+alt+'\">');
	newWindow.document.write('</body></html>');
	newWindow.document.close();
	newWindow.focus(); 

}




function clear_search() {

  document.search.search.value = "";

}

function printf(url_address) {

	 var URL, url_address;
	 URL = "print.php?print=page"+url_address;	 
	 window.open(URL, 'NewPopup','scrollbars=yes, height=600, width=800 , left=50 , top=50');

}

function calCheck(lang) 
{
	var lang;
	var name = document.getElementById('name').value;
	var email= document.getElementById('email').value;
	var phone= document.getElementById('phone').value;
	
	if(name == "")
	{
		if(lang == 'estonian')
		{
			alert('Palun t�ida k�ik kohustuslikud v�ljad !');
		}
		else if(lang == 'russian')
		{
			alert('??????????, ????????? ??? ??????????? ????');
		}
		else
		{
			alert('Please, feel the "name" field');
		}

		return false;
	}
	else if(email == "")
	{
		if(lang == 'estonian')
		{
			alert('Palun t�ida k�ik kohustuslikud v�ljad !');
		}
		else if(lang == 'russian')
		{
			alert('??????????, ????????? ??? ??????????? ????');
		}
		else
		{
			alert('Please, feel the "e-mail" field');
		}

		return false;
	}
	else if(phone == "")
	{
		if(lang == 'estonian')
		{
			alert('Palun t�ida k�ik kohustuslikud v�ljad !');
		}
		else if(lang == 'russian')
		{
			alert('??????????, ????????? ??? ??????????? ????');
		}
		else
		{
			alert('Please, feel the "e-mail" field');
		}

		return false;
	}
	else {return true;}
}


/*function search_check() 
{
	
	var search = document.getElementById('search').value;
	if(search == "")
	{
		alert('Palun sisesta otsingu s�na');
		return false;
	}
	else {return true;}
}*/


function marketCheck(message) 
{
	var message;
	var name = document.getElementById('name').value;
	var address= document.getElementById('address').value;
	var phone= document.getElementById('phone').value;
	var mail= document.getElementById('mail').value;
	var firm= document.getElementById('firm').value;
	
	if(name == "" || address == "" || phone == "" || mail == "" || firm == "")
	{
		alert(message);

		return false;
	}

	else {return true;}
}



function numeric(message,total){
	
	var message;
	var total;
	var radio;
	var mess2;
	
	for (var i=1; i<=total; i++) {
		
		if (document.getElementById('prod_qty_'+i).value != parseInt(document.getElementById('prod_qty_'+i).value)){
		
			alert(document.getElementById('prod_qty_'+i).value+" "+ message);
		
			return false;
		
		}
		
	}
	
	return true;
}


function getSelectedRadio(buttonGroup) {
   // returns the array number of the selected radio button or -1 if no button is selected
    if (buttonGroup[0]) { // if the button group is an array (one button is not an array)
      for (var i=0; i<buttonGroup.length; i++) {
         if (buttonGroup[i].checked) {
            return i;
         }
      }
   } else {
      if (buttonGroup.checked) { return 0; } // if the one button is checked, return zero
   }
   // if we get to this point, no radio button is selected
   return -1;
} // Ends the "getSelectedRadio" function



function RadioCheck(mess){
	
	
	if(document.getElementById('answer_id').value == "") {
		alert(mess);
	}
	else{
		document.getElementById('gallup').submit();
	}
	
}
