			  function td_over(s){
			  	s.className='btn_details_over';
			  }
			  function td_out(s){
			  	s.className='btn_details';
			  }

function color(s,scolor){
	s.bgColor=scolor;
}
function vis_on(s){
	document.getElementById(s).style.visibility="visible";
}
function vis_off(s){
document.getElementById(s).style.visibility="hidden";	
}

function disnone_time(divid){
	cancel_timeout();
	droptime=setTimeout('document.getElementById("'+divid+'").style.display="none"',600);
}
function disblock_time(divid){
	cancel_timeout();
	document.getElementById(divid).style.display="block";
	//$('#'+divid).slideDown('fast');
	//$('#'+divid).show();
	//droptime=setTimeout('document.getElementById("'+divid+'").style.display="block"',600);
}

function show2(s){
		document.getElementById(s).style.display="block";
}


function hidden2(s){
		document.getElementById(s).style.display="none";
}
function showid(s,flag){
		document.getElementById("bg_div").style.visibility="visible";
		document.getElementById(s).style.visibility="visible";

		// Get the dimensions of the browser window
		var winwidth = document.body.clientWidth;
		var winheight = document.body.clientHeight;
		
		// Get the dimensions of the layer
		var layerwidth = document.getElementById(s).clientWidth;
		var layerheight = document.getElementById(s).clientHeight;
		
		// Centre the layer

	var arrayPageSize1 = getPageSize();
	document.getElementById("bg_div").style.height =arrayPageSize1[1] +"px";
	document.getElementById("bg_div").style.width =arrayPageSize1[0] +"px";
		xScroll = document.body.scrollWidth;
		yScroll = document.body.scrollTop;
		
document.getElementById(s).style.left = ((winwidth - layerwidth)/2) + "px";
document.getElementById(s).style.top = ((winheight - layerheight)/2)+yScroll + "px";
//alert(yScroll);\
	if(flag==1){ // prosthiki neoy event
		callAHAH('inc_add_event.php', 'div_cont','Παρακαλώ περιμένετε...', 'Error'); 
		}
		if(flag==2){  // apostoli report sfalmatos
		callAHAH('inc_send_report.php', 'div_cont','Παρακαλώ περιμένετε...', 'Error'); 
		}
	
		if(flag==3){ //  prosthiki neas kataxorisis
		callAHAH('inc_add_new.php', 'div_cont','Παρακαλώ περιμένετε...', 'Error'); 
		}

}
//--------------------------------

function hide_divs(){
	document.getElementById("div_cont").style.visibility="hidden";
	document.getElementById("bg_div").style.visibility="hidden";
}

//-------------------------------------------------------------
function common_hide_div(divid){
	obj=document.getElementById(divid);
	if(obj){
	document.getElementById(divid).style.visibility="hidden";
	}
}
function hide_drop(divid){
	cancel_timeout();
	//droptime=document.getElementById(divid).style.visibility="hidden";
	droptime=setTimeout('document.getElementById("'+divid+'").style.visibility="hidden"',600);
}
droptime=0;
function cancel_timeout(){
	if(droptime>0)
	{
		window.clearTimeout(droptime);
		droptime = 0;
	}	
}

function common_dis_div(divid){
	//alert(divid);
	document.getElementById(divid).style.display="block";
}
function common_display_show_hide_div(divid){
	if(	document.getElementById(divid).style.display=="none"){
		document.getElementById(divid).style.display="block";
	} else {
		document.getElementById(divid).style.display="none";
	}
}
function common_dis_none(divid){
	//alert(divid);
	document.getElementById(divid).style.display="none";
}


//-------------------
function getPageSize(){
	
	var xScroll, yScroll;
	
	if (window.innerHeight && window.scrollMaxY) {	
		xScroll = document.body.scrollWidth;
		yScroll = window.innerHeight + window.scrollMaxY;
	} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
		xScroll = document.body.scrollWidth;
		yScroll = document.body.scrollHeight;
	} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
		xScroll = document.body.offsetWidth;
		yScroll = document.body.offsetHeight;
	}
	
	var windowWidth, windowHeight;
	if (self.innerHeight) {	// all except Explorer
		windowWidth = self.innerWidth;
		windowHeight = self.innerHeight;
	} else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
		windowWidth = document.documentElement.clientWidth;
		windowHeight = document.documentElement.clientHeight;
	} else if (document.body) { // other Explorers
		windowWidth = document.body.clientWidth;
		windowHeight = document.body.clientHeight;
	}	
	
	// for small pages with total height less then height of the viewport
	if(yScroll < windowHeight){
		pageHeight = windowHeight;
	} else { 
		pageHeight = yScroll;
	}

	// for small pages with total width less then width of the viewport
	if(xScroll < windowWidth){	
		pageWidth = windowWidth;
	} else {
		pageWidth = xScroll;
	}

	arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight) 
	return arrayPageSize;
}
//-------------------------------------------------

//change the opacity for different browsers
function det_set_var(value){
	var_btn=value;
}
//---------------------------------------------------------------------------------------------------------------------------------------------
		function getRealTop(el){
					yPos = document.getElementById(el).offsetTop;
					tempEl = document.getElementById(el).offsetParent;
						while (tempEl != null) {
						yPos += tempEl.offsetTop;
						tempEl = tempEl.offsetParent;
						}
						return yPos;
		}

function getY(oElement)
{
		var iReturnValue = 0;
		while( oElement != null ) {
		iReturnValue += oElement.offsetTop;
		oElement = oElement.offsetParent;
		}
		return iReturnValue;
}
	function getRealLeft(el){
			xPos = document.getElementById(el).offsetLeft;
			tempEl = document.getElementById(el).offsetParent;
							while (tempEl != null) {
							xPos += tempEl.offsetLeft;
							tempEl = tempEl.offsetParent;
							}
			return xPos;
	}

function popup_nofade(id,div_id,my_width,my_height){// where-what
	cancel_timeout();
	
	div_over=true;
	trueX = getRealLeft(id);
	trueY = getRealTop(id);
	// p = $('#'+id);
	// position = p.position();
	//trueX=position.left;
	//trueY=position.top;
//alert(position.left);
	//trueY = getY(id);
	document.getElementById(div_id).style.top=trueY+my_height+"px";
	document.getElementById(div_id).style.left=trueX-my_width+"px";
	document.getElementById(div_id).style.visibility="visible";
	document.getElementById(div_id).style.display="block";
	//alert('');
}

//---------------------------------------------------------------------------------------------------------------------------------------------



var req;
function call_ajax(url, pageElement, callMessage, errorMessage) {
			

     if(pageElement!==''){
	 document.getElementById(pageElement).innerHTML = callMessage;
	 }
     try {
     req = new XMLHttpRequest(); /* e.g. Firefox */
     } catch(e) {
       try {
       req = new ActiveXObject("Msxml2.XMLHTTP");  /* some versions IE */
       } catch (e) {
         try {
         req = new ActiveXObject("Microsoft.XMLHTTP");  /* some versions IE */
         } catch (E) {
          req = false;
         } 
       } 
     }
     req.onreadystatechange = function() {
					if(req.status == 200) {
							 output = req.responseText;
							 	if(pageElement!==''){
							 		document.getElementById(pageElement).innerHTML = output;
									//call_ajax(url, pageElement, callMessage, errorMessage)
							 	}
							
					 }	else {
								  if(pageElement!==''){
							 		document.getElementById(pageElement).innerHTML = errorMessage+"\n"+output;
								  }
					}	 
		 
		}; // end function
     req.open("GET",url,true);
     req.send(null);
  }
  /////////////////--------------- -------------------------------------------------------------------------------
function validateEmail(s) {
		   var emailstring = s;//document.enter.email.value;
		   //alert(emailstring);
		   var ampIndex = emailstring.indexOf("@");
		   var afterAmp = emailstring.substring((ampIndex + 1), emailstring.length);
		   // find a dot in the portion of the string after the ampersand only
		   var dotIndex = afterAmp.indexOf(".");
		   // determine dot position in entire string (not just after amp portion)
		   dotIndex = dotIndex + ampIndex + 1;
		   // afterAmp will be portion of string from ampersand to dot
		   afterAmp = emailstring.substring((ampIndex + 1), dotIndex);
		   // afterDot will be portion of string from dot to end of string
		   var afterDot = emailstring.substring((dotIndex + 1), emailstring.length);
		   var beforeAmp = emailstring.substring(0,(ampIndex));
		  // var regex = /\;|#|\$|%|\^|&|\*|\(|\)|\+|\\|\/|\?|>|<|\{|\}|\,|\[|\]|\`|\|/;
		   var regex = /^\w+[\+\.\w-]*@([\w-]+\.)*\w+[\w-]*\.([a-z]{2,4}|\d+)$/i;
		   // index of -1 means "not found"
		   if ((emailstring.indexOf("@") != "-1") &&
		      (emailstring.length > 5) &&
		      (afterAmp.length > 0) &&
		      (beforeAmp.length > 1) &&
		      (afterDot.length > 1) &&
		      (regex.test(emailstring)) ) {
			  //document.enter.submit();
			  return true;
		   } else {
		      //alert("Παρακαλώ εισάγετε μια έγκυρη -Διεύθυνση email-!");
		     // document.form1.email.focus();
		      return false;
		   }
		}
/////////////////----------------------------------------------------------------------------------------------

function bg_color_white(s){
	s.style.background='#ffffff';
}

function strrev(str) {
   if (!str) return '';
   var revstr='';
   for (i = str.length-1; i>=0; i--)
       revstr+=str.charAt(i)
   return revstr;
}


function ihtml(div,message){
	document.getElementById(div).innerHTML=message;
}


	function do_login_top(formname){
		user=escape(formname.user.value);
		passw=escape(formname.passw.value);
		remember=0;
		if(formname.remember.checked){
			remember=1;
		}
		callAHAH('inc_get_login.php?u='+user+'&p='+passw+'&remember='+remember, 'div_top_login','', 'Error'); 
	}

	function do_login_new(formname){
		//alert('');
		user=escape(formname.login_user.value);
		passw=escape(formname.login_passw.value);
		//alert(user);
		remember=0;
		if(formname.login_remember.checked){
			remember=1;
		}
		callAHAH('inc_get_login.php?u='+user+'&p='+passw+'&remember='+remember, 'div_new_login','<div align=center><img src="img/loader1.gif"></div>', 'Error'); 
	}


	function do_login_cpage(formname){
		user=document.getElementById('cuser').value;
		passw=document.getElementById('cpassw').value;
		remember=0;
		if(document.getElementById('cremember').checked){
			remember=1;
		}
		callAHAH('inc_get_login.php?reload=1&u='+user+'&p='+passw+'&remember='+remember, 'div_clogin','', 'Error'); 
	}

//----------------------------------------
	function do_login(s){
		user=document.form_login.user.value;
		passw=document.form_login.passw.value;
		//alert(user);
		callAHAH('inc_get_login.php?u='+user+'&p='+passw, 'div_login','', 'Error'); 
		//alert(response);
		//alert(go_next);
	
	
	}
	
	function go(){
	location='?#add_comment';
	}
//---------------------------------------------------	



function common_div(element){
	//vardocument.write('<div id="div_common_message"></div>');	
	if(!document.getElementById('div_common_message')){
	var newdiv = document.createElement('div');
 	  newdiv.setAttribute('id','div_common_message');
   newdiv.innerHTML = '  <div id="div_common_message_xclose" align=right><a class="xclose1" href="javascript:common_hide_div(\'div_common_message\');">Κλείσιμο</a></div><div id="div_common_message_data"></div>';

   document.body.appendChild(newdiv);
	}
	popup_nofade(element,'div_common_message',11,11);
}

function create_div(element){
	//vardocument.write('<div id="div_common_message"></div>');	
	var o= document.getElementById(element);

	if(!o) {
	var newdiv = document.createElement('div');
 	  newdiv.setAttribute('id',element);
	  
      document.body.appendChild(newdiv);
	}
}


function prind_2_div(div,message){

	document.getElementById(div).innerHTML=message;

}

function coo(n,v){
//alert('');
stype=1;// 1=gouria, 2-products
	var D=new Date();
	var T=(v!='')? new Date(D.getTime()+1000*60*60*24*365):new Date(D.getTime()-1000);

document.cookie=n+'='+escape(v);//+'; expires='+T.toGMTString()+'; path=/';
location='deal_u_view_basket.php';
}


function showdiv_deal_faq(pass) {

		var divs = document.getElementsByTagName('div');
		for(i=0;i<divs.length;i++){
		//alert(divs[i]);
			if(divs[i].id==pass){
				//doSlide(divs[i].id);
				divs[i].style.display="block";
				}	
		
			else // IE 4 
				{
					if(divs[i].id.match('deal_faq_data_')){
						divs[i].style.display="none";
					}
				}
		}
} 

function doSlide(id){
timeToSlide = 50; // in milliseconds
obj = document.getElementById(id);
if(obj.style.display == "none"){ // if it's allready hidden we slide it down
	obj.style.visibility = "hidden";
	obj.style.display = "block";
	height = obj.offsetHeight;
	obj.style.height="0px";
	obj.style.visibility = "visible";
	slideDown(obj,0,height,Math.ceil(height/timeToSlide));
} else {
	slideUp(obj,Math.ceil(obj.offsetHeight/timeToSlide),obj.offsetHeight);
}
}

function slideDown(obj,offset,full,px){
if(offset < full){
	obj.style.height = offset+"px";
	offset=offset+px;
	setTimeout((function(){slideDown(obj,offset,full,px);}),1);
} else {
	obj.style.height = full+"px"; //If the data inside is updated on runtime you can use auto instead...
}
}

function slideUp(obj,px,full){
	if((obj.offsetHeight-px) > 0){
		obj.style.height = obj.offsetHeight-px+"px";
		setTimeout((function(){slideUp(obj,px,full);}),1);
	} else {
		obj.style.height=full+"px"; // we reset the height if we were to slide it back down
		obj.style.display = 'none';
	}
}

	function add_basket(id){
	//alert(id);
	q="quant_"+id+"";
	sdiv="div_"+id;
	//document.div_1.style.visibility="visible";
	//document.getElementById(sdiv).style.visibility="hidden";
	//alert(q);
	quant=document.getElementById(q).value;
	//$("#div_1918").fadeIn();
	//alert(quant);
	//return;
	//alert(quant);
	callAHAH("inc_add_basket.php?add_basket="+id+"&quant="+quant, sdiv, '<img src="img/loading_orange.gif" />','Σφάλμα!!');
	}

function cfield(field,message){

		form='form_new_user';
		s='document.'+form+'.'+field+'.value';
		el='document.'+form+'.'+field;
		
		if(eval(s)==''){
			alert('Συμπληρώστε όλα τα υποχρεωτικά πεδία(*)');
			s='document.'+form+'.'+field;
			eval(s).focus();
			
			eval(el).style.background='#FDFAB5';
			ok=false;
		} else {
			ok=true;
			eval(el).style.background='#EAEAEA';
		}	
		return ok;
}

function check_new_member(s){
	
	if(!cfield('user','ΟΝΟΜΑ')){return false;}
	 if(!cfield('passw','ΕΠΩΝΥΜΟ')){return false;}
	 if(!cfield('title','ΕΠΩΝΥΜΟ')){return false;}
	 if(!cfield('address','ΕΠΩΝΥΜΟ')){return false;}
	 if(!cfield('city','ΕΠΩΝΥΜΟ')){return false;}
	 if(!cfield('afm','ΕΠΩΝΥΜΟ')){return false;}
	 if(!cfield('doy','ΕΠΩΝΥΜΟ')){return false;}
	 if(!cfield('phone','ΕΠΩΝΥΜΟ')){return false;}
	 if(!cfield('email','ΕΠΩΝΥΜΟ')){return false;}
	 if(!cfield('secure','ΕΠΩΝΥΜΟ')){return false;}
	 if(!cfield('phone','ΕΠΩΝΥΜΟ')){return false;}
	
		user=escape(document.form_new_user.user.value);
		passw=escape(document.form_new_user.passw.value);
	
 		user_l=user.length;
		passw_l=passw.length;
	if(user_l<6){
		alert('Το username πρέπει να αποτελείται από τουλάχιστον 6 χαρακτήρες');
		document.forms.form_new_user.user.focus();
		return false;

	}
	if(passw_l<6){
		alert('Το -password- πρέπει να αποτελείται από τουλάχιστον 6 χαρακτήρες');
		document.forms.form_new_user.passw.focus();
		return false;

	}	
	 
 	passw=document.forms.form_new_user.passw.value;
	repassw=document.forms.form_new_user.repassw.value;
	if(passw!==repassw){
		alert('Παρακαλώ επιβεβαιώστε το -password-');
		document.forms.form_new_user.repassw.focus();
		return false;
		
	}
	type=document.forms.form_new_user.secure.value;
	callAHAHc('check_secure.php?type='+type, 'secure_msg','Περιμένετε...', 'error'); 


}

function check_upd_member(s){
	
	if(!cfield('user','ΟΝΟΜΑ')){return false;}
	 if(!cfield('passw','ΕΠΩΝΥΜΟ')){return false;}
	 if(!cfield('title','ΕΠΩΝΥΜΟ')){return false;}
	 if(!cfield('address','ΕΠΩΝΥΜΟ')){return false;}
	 if(!cfield('city','ΕΠΩΝΥΜΟ')){return false;}
	 if(!cfield('afm','ΕΠΩΝΥΜΟ')){return false;}
	 if(!cfield('doy','ΕΠΩΝΥΜΟ')){return false;}
	 if(!cfield('phone','ΕΠΩΝΥΜΟ')){return false;}
	 if(!cfield('email','ΕΠΩΝΥΜΟ')){return false;}
	
	 if(!cfield('phone','ΕΠΩΝΥΜΟ')){return false;}
	
		user=escape(document.form_new_user.user.value);
		passw=escape(document.form_new_user.passw.value);
	
 		user_l=user.length;
		passw_l=passw.length;
	if(user_l<6){
		alert('Το username πρέπει να αποτελείται από τουλάχιστον 6 χαρακτήρες');
		document.forms.form_new_user.user.focus();
		return false;

	}
	if(passw_l<6){
		alert('Το -password- πρέπει να αποτελείται από τουλάχιστον 6 χαρακτήρες');
		document.forms.form_new_user.passw.focus();
		return false;

	}	
	 
 	passw=document.forms.form_new_user.passw.value;
	repassw=document.forms.form_new_user.repassw.value;
	if(passw!==repassw){
		alert('Παρακαλώ επιβεβαιώστε το -password-');
		document.forms.form_new_user.repassw.focus();
		return false;
		
	}
		 s.form.submit();

}

