var incr=0;
function checkprovince(){
var box=document.getElementById('location');
if (box.options[box.selectedIndex].value=="Rest of Greece"){
document.getElementById('hiddenprovince').style.visibility='visible';
document.getElementById('hiddenprovince2').style.visibility='visible';
}
else {
document.getElementById('hiddenprovince').style.visibility='hidden';
document.getElementById('hiddenprovince2').style.visibility='hidden';
}
}
function checkprovince2(){
var box2=document.getElementById('location2');
if (box2.options[box2.selectedIndex].value=="Rest of Greece"){
document.getElementById('hiddenprovince_2').style.visibility='visible';
document.getElementById('hiddenprovince_22').style.visibility='visible';
}
else {
document.getElementById('hiddenprovince_2').style.visibility='hidden';
document.getElementById('hiddenprovince_22').style.visibility='hidden';
}
}
function checkfirst(){
if (document.getElementById('name').value=="" || document.getElementById('surname').value==""){
alert('Δεν έχετε καταχωρήσει το ονοματεπώνυμο του μοντέλου.');
return false;
}
else {
document.getElementById('xostisform').submit();
document.getElementById('main').innerHTML="<span style='font-family:verdana;font-size:12px;font-weight:bold;color:#ffffff'><img align=middle src=highslide/graphics/ajax-loader.gif> Το μοντέλο αποθηκεύεται...<br><br>Ανάλογα με το μέγεθος των φωτογραφιών ,<br>η αποστολή μπορεί να διαρκέσει μερικά λεπτά.</b><br><br> Μπορείτε να κάνετε άλλες εργασίες στην ιστοσελίδα μέχρι να ολοκληρωθεί η αποστολή. <br>(Αρκεί να μην κλείσετε την σελίδα ή να μην κάνετε refresh)<br><br>Θα ειδοποιηθείτε στο πάνω μέρος της σελίδας για την ολοκλήρωση.</span>";
}
}


function restoff(id){
for(var ml=0;ml<menuclick.length;ml++){ 
       if(menuclick[ml]==id){
            document.getElementById(id).className='roundbuttonover';
            }
            else{
             if (menuclick[ml].match('admin')){
             document.getElementById(menuclick[ml]).className='roundbuttonadm';
}
else{
			document.getElementById(menuclick[ml]).className='roundbutton';
			}
            }
            }
}


function loaderon(img,message){
if (img==null){
img="";
}
else{
img="<img src=highslide/graphics/ajax-loader.gif align=middle> ";
}
if (message==null){
message="Loading...";
}
document.getElementById('messages').innerHTML=img+message;
}
function loaderoff(){
document.getElementById('messages').innerHTML='';
}

function loaderon2(){
document.getElementById('analogies1').style.visibility='hidden';
document.getElementById('bemodel').style.visibility='hidden';
document.getElementById('analogies2').style.visibility='hidden';
document.getElementById('loading2').style.visibility='visible';
document.getElementById('loading2').style.height='auto';
}


	function checkall(){
			var incr=0;
				if (document.getElementById('category').value=="nada"){
			alert('Δεν έχετε επιλέξει φύλο/κατηγορία.');
			return false;
			incr++;
			}
			if (document.getElementById('name').value==""){
			alert('Δεν έχετε συμπληρώσει το όνομά σας');
			return false;
			incr++;
			}
			uname=document.getElementById('name').value;
			var ress=alphanumeric(uname);
if (ress=="0"){
			alert('Το όνομά σας πρέπει να περιέχει ΜΟΝΟ λατινικούς χαρακτήρες');
			return false;
			incr++;
}
			usurname=document.getElementById('surname').value;
			var ress2=alphanumeric(usurname);
if (ress2=="0"){
			alert('Το επώνυμό σας πρέπει να περιέχει ΜΟΝΟ λατινικούς χαρακτήρες');
			return false;
			incr++;
}			
			
			if (document.getElementById('surname').value==""){
			alert('Δεν έχετε συμπληρώσει το επώνυμό σας');
			return false;		
			incr++;
			}
			if (document.getElementById('email').value==""){
			alert('Δεν έχετε συμπληρώσει το email σας');
			return false;		
			incr++;
			}
			var emtext=document.getElementById('email').value;
			if (emtext.search("@")<0){
			alert('Το email σας δεν έχει την σωστή μορφή');
			return false;
			incr++;
			}
		if (emtext.search("\\.")<0){
			alert('Το email σας δεν έχει την σωστή μορφή');
			return false;
			incr++;
			}
		
			if (document.getElementById('birthdate').options[document.getElementById('birthdate').selectedIndex].value=="nothing"){
			alert('Δεν έχετε επιλέξει την χρονολογία γέννησής σας');
			return false;
			incr++;
			}
				if (document.getElementById('weight').options[document.getElementById('weight').selectedIndex].value=="nada"){
			alert('Δεν έχετε συμπληρώσει το βάρος σας');
			return false;
			incr++;
			}
			if (document.getElementById('height').options[document.getElementById('height').selectedIndex].value=="nothing"){
			alert('Δεν έχετε επιλέξει το ύψος σας');
			return false;
			incr++;
			}
				if (document.getElementById('bust').value=="nada" && document.getElementById('category').value=='Γυναίκα'){
			alert('Δεν έχετε συμπληρώσει τις διαστάσεις του στήθους σας (cm)');
			return false;
			incr++;
			}
		if (document.getElementById('hips').value=="nada" && document.getElementById('category').value=='Γυναίκα'){
			alert('Δεν έχετε συμπληρώσει τις διαστάσεις της περιφέρειάς σας (cm)');
			return false;
			incr++;
			}
		if (document.getElementById('waist').value=="nada" && document.getElementById('category').value=='Γυναίκα'){
			alert('Δεν έχετε συμπληρώσει τις διαστάσεις της μέσης σας (cm)');
			return false;
			incr++;
			}
			
		
		if (document.getElementById('haircolor').value=="nada"){
			alert('Δεν έχετε συμπληρώσει το χρώμα μαλλιών σας');
			return false;
			incr++;
			}
				if (document.getElementById('eyecolor').value=="nada"){
			alert('Δεν έχετε συμπληρώσει το χρώμα ματιών σας');
			return false;
			incr++;
			}
				if (document.getElementById('shoe').value=="nada"){
			alert('Δεν έχετε συμπληρώσει το Νο. Παπούτσι σας');
			return false;
			incr++;
			}
		
			if (document.getElementById('Country').value=="nada"){
			alert('Δεν έχετε συμπληρώσει την χώρα προέλευσής σας');
			return false;
			incr++;
			}
			if (document.getElementById('livingcountry').value=="nada"){
			alert('Δεν έχετε συμπληρώσει την χώρα διαμονής σας');
			return false;
			incr++;
			}			
				if (document.getElementById('nomos').value=="nada"){
			alert('Δεν έχετε συμπληρώσει τον νομό κατοικίας σας');
			return false;
			incr++;
			}	
				if (document.getElementById('phone').value==""){
			alert('Δεν έχετε συμπληρώσει το τηλέφωνό σας');
			return false;
			incr++;
			}
			if (document.getElementById('F1').value==""){
			alert('Δεν έχετε συμπληρώσει τουλάχιστον 5 φωτογραφίες σας');
			return false;
			incr++;
			}
			if (document.getElementById('F2').value==""){
			alert('Δεν έχετε συμπληρώσει τουλάχιστον 5 φωτογραφίες σας');
			return false;
			incr++;
			}
    		if (document.getElementById('F3').value==""){
			alert('Δεν έχετε συμπληρώσει τουλάχιστον 5 φωτογραφίες σας');
			return false;
			incr++;
			}
			if (document.getElementById('F4').value==""){
			alert('Δεν έχετε συμπληρώσει τουλάχιστον 5 φωτογραφίες σας');
			return false;
			incr++;
			}
			if (document.getElementById('F5').value==""){
			alert('Δεν έχετε συμπληρώσει τουλάχιστον 5 φωτογραφίες σας');
			return false;
			incr++;
			}
		if (document.getElementById('comments').value==""){
			alert('Δεν έχετε συμπληρώσει μερικά σχόλια για τον εαυτό σας.');
			return false;
			incr++;
			}
			if (incr=="0"){
 			
			loaderon(1,'You might be a model soon...');
			
var sendvalues='category='+document.getElementById('category').value+'&name='+document.getElementById('name').value+'&surname='+document.getElementById('surname').value+'&email='+document.getElementById('email').value+'&birthdate='+document.getElementById('birthdate').value+'&weight='+document.getElementById('weight').value+'&height='+document.getElementById('height').value+'&shoe='+document.getElementById('shoe').value+'&Country='+document.getElementById('Country').value+'&livingcountry='+document.getElementById('livingcountry').value+'&eyecolor='+document.getElementById('eyecolor').value+'&haircolor='+document.getElementById('haircolor').value+'&nomos='+document.getElementById('nomos').value+'&phone='+document.getElementById('phone').value+'&hips='+document.getElementById('hips').value+'&waist='+document.getElementById('waist').value+'&bust='+document.getElementById('bust').value+'&comments='+document.getElementById('comments').value+'&&sf=l';
			ajax('send.php','main',sendvalues,'POST');
			
			}
			}
			
			function checkrest(){
					var incr=0;
				if (document.getElementById('category').value=="nada"){
			alert('Δεν έχετε επιλέξει φύλο/κατηγορία.');
			return false;
			incr++;
			}
			if (document.getElementById('name').value==""){
			alert('Δεν έχετε συμπληρώσει το όνομά σας');
			return false;
			incr++;
			}
			uname=document.getElementById('name').value;
			var ress=alphanumeric(uname);
if (ress=="0"){
			alert('Το όνομά σας πρέπει να περιέχει ΜΟΝΟ λατινικούς χαρακτήρες');
			return false;
			incr++;
}
			usurname=document.getElementById('surname').value;
			var ress2=alphanumeric(usurname);
if (ress2=="0"){
			alert('Το επώνυμό σας πρέπει να περιέχει ΜΟΝΟ λατινικούς χαρακτήρες');
			return false;
			incr++;
}			
			
			if (document.getElementById('surname').value==""){
			alert('Δεν έχετε συμπληρώσει το επώνυμό σας');
			return false;		
			incr++;
			}
			if (document.getElementById('email').value==""){
			alert('Δεν έχετε συμπληρώσει το email σας');
			return false;		
			incr++;
			}
			var emtext=document.getElementById('email').value;
			if (emtext.search("@")<0){
			alert('Το email σας δεν έχει την σωστή μορφή');
			return false;
			incr++;
			}
		if (emtext.search("\\.")<0){
			alert('Το email σας δεν έχει την σωστή μορφή');
			return false;
			incr++;
			}
		
			if (document.getElementById('birthdate').options[document.getElementById('birthdate').selectedIndex].value=="nothing"){
			alert('Δεν έχετε επιλέξει την χρονολογία γέννησής σας');
			return false;
			incr++;
			}
				if (document.getElementById('weight').options[document.getElementById('weight').selectedIndex].value=="nada"){
			alert('Δεν έχετε συμπληρώσει το βάρος σας');
			return false;
			incr++;
			}
			if (document.getElementById('height').options[document.getElementById('height').selectedIndex].value=="nothing"){
			alert('Δεν έχετε επιλέξει το ύψος σας');
			return false;
			incr++;
			}
				if (document.getElementById('bust').value=="nada" && document.getElementById('category').value=='Γυναίκα'){
			alert('Δεν έχετε συμπληρώσει τις διαστάσεις του στήθους σας (cm)');
			return false;
			incr++;
			}
		if (document.getElementById('hips').value=="nada" && document.getElementById('category').value=='Γυναίκα'){
			alert('Δεν έχετε συμπληρώσει τις διαστάσεις της περιφέρειάς σας (cm)');
			return false;
			incr++;
			}
		if (document.getElementById('waist').value=="nada" && document.getElementById('category').value=='Γυναίκα'){
			alert('Δεν έχετε συμπληρώσει τις διαστάσεις της μέσης σας (cm)');
			return false;
			incr++;
			}
			
		
		if (document.getElementById('haircolor').value=="nada"){
			alert('Δεν έχετε συμπληρώσει το χρώμα μαλλιών σας');
			return false;
			incr++;
			}
				if (document.getElementById('eyecolor').value=="nada"){
			alert('Δεν έχετε συμπληρώσει το χρώμα ματιών σας');
			return false;
			incr++;
			}
				if (document.getElementById('shoe').value=="nada"){
			alert('Δεν έχετε συμπληρώσει το Νο. Παπούτσι σας');
			return false;
			incr++;
			}
		
			if (document.getElementById('Country').value=="nada"){
			alert('Δεν έχετε συμπληρώσει την χώρα προέλευσής σας');
			return false;
			incr++;
			}
			if (document.getElementById('livingcountry').value=="nada"){
			alert('Δεν έχετε συμπληρώσει την χώρα διαμονής σας');
			return false;
			incr++;
			}			
				if (document.getElementById('nomos').value=="nada"){
			alert('Δεν έχετε συμπληρώσει τον νομό κατοικίας σας');
			return false;
			incr++;
			}	
				if (document.getElementById('phone').value==""){
			alert('Δεν έχετε συμπληρώσει το τηλέφωνό σας');
			return false;
			incr++;
			}
			
			if (incr<1){
			return true;
			}
			}
			
			function checkcat(){
			if (document.getElementById('category').value=='Γυναίκα'){
			document.getElementById('analogies1').style.visibility='visible';
			document.getElementById('analogies2').style.visibility='visible';
			}
			else {
			document.getElementById('analogies1').style.visibility='hidden';
			document.getElementById('analogies2').style.visibility='hidden';

			}
			}
			function closevid(){
			try{
			return hs.close(document.getElementById('modelvideo'));
			}
			catch(err){}
			}
			function swap(div){
			mydiv=document.getElementById(div);
			if (mydiv.style.visibility=='visible'){
			mydiv.style.visibility='hidden';
			mydiv.style.height='0px';
			}
			else{
			mydiv.style.visibility='visible';
			mydiv.style.height='auto';
			}
			}
			function hide(div){
			document.getElementById(div).style.visibility='hidden';
			document.getElementById(div).style.height='0px';
			}
			function show(div){
			document.getElementById(div).style.visibility='visible';
			document.getElementById(div).style.height='auto';
			}
	function swapall(div){
			divar=document.getElementsByTagName('div');
			for (s=0;s<divar.length;s++){
			thediv=divar[s];
			if (thediv.className=='answerdiv'){
			thediv.style.visibility='hidden';
			thediv.style.height='0';
			}
			}
			mydiv=document.getElementById(div);
			if (mydiv.style.visibility=='visible'){
			mydiv.style.visibility='hidden';
			mydiv.style.height='0px';
						}
			else{
			mydiv.style.visibility='visible';
			mydiv.style.height='auto';
			}
			}

function handle(delta) {
        if (delta < 0){
        try{
document.getElementById('nextp').onclick();
}
catch(err){}
}
        else{
        try{
document.getElementById('previousp').onclick();
}
catch(err){}
}
}


function wheel(event){
        var delta = 0;
        if (!event) /* For IE. */
                event = window.event;
        if (event.wheelDelta) { /* IE/Opera. */
                delta = event.wheelDelta/40;
                          if (window.opera)
                        delta = -delta;
        } else if (event.detail) { /** Mozilla case. */
                          delta = -event.detail/3;
        }
        
        if (delta)
                handle(delta);
        
        if (event.preventDefault)
                event.preventDefault();
   	event.returnValue = false;
}

function hookEvent(element, eventName, callback)
{
  if(typeof(element) == "string")
    element = document.getElementById(element);
  if(element == null)
    return;
  if(element.addEventListener)
  {
    if(eventName == 'mousewheel')
      element.addEventListener('DOMMouseScroll', callback, false);  
    element.addEventListener(eventName, callback, false);
  }
  else if(element.attachEvent)
    element.attachEvent("on" + eventName, callback);
}

function unhookEvent(element, eventName, callback)
{
  if(typeof(element) == "string")
    element = document.getElementById(element);
  if(element == null)
    return;
  if(element.removeEventListener)
  {
    if(eventName == 'mousewheel')
      element.removeEventListener('DOMMouseScroll', callback, false);  
    element.removeEventListener(eventName, callback, false);
  }
  else if(element.detachEvent)
    element.detachEvent("on" + eventName, callback);
}
function cancelEvent(e)
{
  e = e ? e : window.event;
  if(e.stopPropagation)
    e.stopPropagation();
  if(e.preventDefault)
    e.preventDefault();
  e.cancelBubble = true;
  e.cancel = true;
  e.returnValue = false;
  return false;
}

document.onkeydown = function (e) {
    if (window.event)
        Key = window.event.keyCode;
    else
        Key = e.which;
    if (Key == 37){
    try{
document.getElementById('previousp').click();
}catch(err){}
             }
            if (Key == 39){
            try{
document.getElementById('nextp').click();
}catch(err){}
        }
         if (Key == 13){
            try{
document.getElementById('sendmessage').onclick();
document.getElementById('texter').value='';
document.getElementById('texter').focus();
return false;
}catch(err){}
        }

}
function addslashes(str) {
str=str.replace(/\\/g,'\\\\');
str=str.replace(/\'/g,'\\\'');
str=str.replace(/\"/g,'\\"');
str=str.replace(/\0/g,'\\0');
return str;
}
function alphanumeric(alphane)
{
	var numaric = alphane;
	for(var j=0; j<numaric.length; j++)
		{
		  var alphaa = numaric.charAt(j);
		  var hh = alphaa.charCodeAt(0);
		  if((hh > 47 && hh<58) || (hh > 64 && hh<91) || (hh > 96 && hh<123))
		  {
		  }
		else	{
			 return false;
		  }
		}
 return true;
}
function usertable(){
ajax('menutable.php','menu');
ajax('usertable.php','userdiv');
//document.getElementById('searchtext').focus();
}
function disconnect(){
ajax('disconnect.php','userdiv');
ajax('leftmenu.php','menuleft');
ajax('main.php','main');
//document.getElementById('prechat').style.visibility='hidden';
document.getElementById('adminlogo').style.visibility='hidden';
}



function la(){
ajax('leftmenuadmin.php','menuleft');
}
function delmodel(id){
ajax('delmodel.php','main','id='+id+'&hs=l','POST');
}
function checkprenames(){
			uname=document.getElementById('prename').value;
			var ress=alphanumeric(uname);
if (ress=="0"){
			alert('Το όνομά σας πρέπει να περιέχει ΜΟΝΟ λατινικούς χαρακτήρες');
			return false;
			}
			usurname=document.getElementById('presurname').value;
			var ress2=alphanumeric(usurname);
if (ress2=="0"){
			alert('Το επώνυμό σας πρέπει να περιέχει ΜΟΝΟ λατινικούς χαρακτήρες');
			return false;
			}
			if (ress!=0 && ress2!=0){
			return true;
}		
}
function disablerest(id){
filearr=document.getElementsByTagName('input');
for(s=-1;s<filearr.length;s++){
if(filearr[s].id.match("F1") && !filearr[s].id.match(id)){
filearr[s].disabled=true;
}
}
}
//setInterval("ajax('refresh.php','')",60000);
interval2=setInterval("ajax('stats.php','stats')",15000);
ajax('stats.php','stats');
function checkforenter(e){
var keycode;
if (window.event) keycode = window.event.keyCode;
else if (e) keycode = e.which;
else return true;
if (keycode == 13){
document.getElementById('sendname').onclick();
}
}

function exchangedivs(fromdiv,todiv){
var source=document.getElementById(fromdiv);
var destination=document.getElementById(todiv);
document.getElementById('ghostdiv').innerHTML=source.innerHTML;
destination.innerHTML=document.getElementById('ghostdiv').innerHTML;
source.innerHTML=destination.innerHTML;
document.getElementById('ghostdiv').innerHTML='';
//mouseUp(source);
}

function checkfotos(){
if (document.getElementById('imageholder1').innerHTML.match('Please') || document.getElementById('imageholder2').innerHTML.match('Please') || document.getElementById('imageholder3').innerHTML.match('Please') || document.getElementById('imageholder4').innerHTML.match('Please') || document.getElementById('imageholder5').innerHTML.match('Please') || document.getElementById('imageholder6').innerHTML.match('Please') || document.getElementById('imageholder7').innerHTML.match('Please') || document.getElementById('imageholder8').innerHTML.match('Please') || document.getElementById('imageholder9').innerHTML.match('Please') || document.getElementById('imageholder10').innerHTML.match('Please') || document.getElementById('imageholder11').innerHTML.match('Please') || document.getElementById('imageholder12').innerHTML.match('Please') || document.getElementById('imageholder13').innerHTML.match('Please')  || document.getElementById('imageholder14').innerHTML.match('Please')  || document.getElementById('imageholder15').innerHTML.match('Please')){
alert('Please wait...uploading photo...');
return false;
}
else{
return true;
}
}

