// JavaScript Document
function grayOut(vis, options) {
		var options = options || {}; 
		var zindex = options.zindex || 50;
		var opacity = options.opacity || 70;
		var opaque = (opacity / 100);
		var bgcolor = options.bgcolor || '#ffffff';
		var dark=document.getElementById('darkenScreenObject');
		if (!dark) {
			var tbody = document.getElementsByTagName("body")[0];
			var tnode = document.createElement('div');           // Create the layer.
				tnode.style.position='absolute';                 // Position absolutely
				tnode.style.top='0px';                           // In the top
				tnode.style.left='0px';                          // Left corner of the page
				tnode.style.overflow='hidden';                   // Try to avoid making scroll bars            
				tnode.style.display='none';                      // Start out Hidden
				tnode.id='darkenScreenObject';                   // Name it so we can find it later
			tbody.appendChild(tnode);                            // Add it to the web page
			dark=document.getElementById('darkenScreenObject');  // Get the object.
		}
		if (vis) {
			
			if (self.innerHeight) // all except Explorer
			{
				x = self.innerWidth;
				y = self.innerHeight;
			}
			else if (document.documentElement && document.documentElement.clientHeight)
				// Explorer 6 Strict Mode
			{
				x = document.documentElement.clientWidth;
				y = document.documentElement.clientHeight;
			}
			else if (document.body) // other Explorers
			{
				x = document.body.clientWidth;
				y = document.body.clientHeight;
			}
			dark.style.opacity=opaque;                      
			dark.style.MozOpacity=opaque;                   
			dark.style.filter='alpha(opacity='+opacity+')'; 
			dark.style.zIndex=zindex;        
			dark.style.backgroundColor=bgcolor;  
			dark.style.width= x+'px';
			dark.style.height= y+'px';
			dark.style.display='block';                          
		} else {
			dark.style.display='none';
		}
		}
		function writePopup(html){
			var tbody = document.getElementsByTagName("body")[0];
			var tnode = document.createElement('div');           // Create the layer.
			tnode.style.position='absolute'; 
			if (self.innerHeight) // all except Explorer
			{
				x = self.innerWidth;
				y = self.innerHeight;
			}
			else if (document.documentElement && document.documentElement.clientHeight)
			{
				x = document.documentElement.clientWidth;
				y = document.documentElement.clientHeight;
			}
			else if (document.body) // other Explorers
			{
				x = document.body.clientWidth;
				y = document.body.clientHeight;
			}
			tnode.style.top=parseInt(x/2-400)+'px';                           // In the top
			tnode.style.left=parseInt(y/2-40)+'px';                          // Left corner of the page
			tnode.style.overflow='hidden';                   // Try to avoid making scroll bars            
			tnode.style.display='block'; 
			tnode.style.zIndex=60;                     // Start out Hidden
			tnode.id='popupDiv';  
			tnode.innerHTML=html;;                 
			tbody.appendChild(tnode);                            // Add it to the web page
			dark=document.getElementById('popupDiv');
		}
function checkForm(aform){
		if(aform.mobile.value=='' ){
			alert("Παρακαλώ συμπληρώστε όλα τα πεδία για να προχωρήσετε");
			return false;
		}

  		var error=1;
		var re10digit=/^\d{10}$/ //regular expression defining a 5 digit number
		if(aform.mobile.value.search(re10digit)!=-1){
			error--;
		}
		else{
			alert("Παρακαλώ δώστε ένα σωστό αριθμό κινητού τηλεφώνου της μορφής 69xxxxxxxx");
			aform.mobile.focus();
			return false;
		}
		if(error==0){
			aform.send2.value='Αποστολή Στοιχείων';
			aform.send2.disabled=true;
			return true;
		}
		return false
	}
	function destroyElementById(elemId){
	var tbody = document.getElementsByTagName("body")[0];  
	var elem=document.getElementById(elemId);
	if(elem)
		tbody.removeChild(elem);
}
function validate(aform){
		if(aform.cardnum.value=='')
		{
			alert('Παρακαλώ συμπληρώστε αριθμό κάρτας');
			return false;
		}
		if(aform.ccv.value==''){
			alert('Παρακαλώ συμπληρώστε τον τριψήφιο αριθμό CCV της κάρτας');
			return false;
		}
		return true;
}
