function ResetSearchInputs() {
	location.replace('index.php?view=4');
}

function ReserSearchInputRentals(Did) {
	location.replace('index.php?view=30&r_sct='+Did);
}

function ReserSearchInputDealer(DealerPro,Did) {

		if (DealerPro == '1') {
			location.replace('index.php?view=9&inp_id='+Did);
		} else if (DealerPro == '2') {
			location.replace('index.php?view=9&inp_id='+Did+'&v_dealprd=3');
		} else if (DealerPro == '3') {
			location.replace('index.php?view=9&inp_id='+Did+'&v_dealprd=5');
		} else if (DealerPro == '4') {
			location.replace('index.php?view=9&inp_id='+Did+'&v_dealprd=7');
		} else if (DealerPro == '5') {
			location.replace('index.php?view=9&inp_id='+Did+'&v_dealprd=9');
		}
	
}
function ResetSearchInputRentalDealer(DealerPro,Did) {

		if (DealerPro == '1') {
			location.replace('index.php?view=9&inp_id='+Did+'&v_dealprd=11&v_rntdealprd=1');
		} else if (DealerPro == '2') {
			location.replace('index.php?view=9&inp_id='+Did+'&v_dealprd=11&v_rntdealprd=2');
		} else if (DealerPro == '3') {
			location.replace('index.php?view=9&inp_id='+Did+'&v_dealprd=11&v_rntdealprd=3');
		} else if (DealerPro == '4') {
			location.replace('index.php?view=9&inp_id='+Did+'&v_dealprd=11&v_rntdealprd=4');
		}
	
}

function ResetSearchInputsOtherSec(View) {
	location.replace('index.php?view='+View);
}


function ShowMotoPhotoPopUp(ImgId) {
	var w = 500, h = 350;
	
	if (document.all || document.layers) {
   		w = screen.availWidth;
   		h = screen.availHeight;
	}

	var popW = 700, popH = 600;
	var leftPos = (w-popW)/2, topPos = (h-popH)/2;

  window.MOTOPHOTOPOPUP = open('moto_photo.php?img_id=' + ImgId, 'MOTOPHOTOPOPUP', 'width=' + popW + ',height=' + popH + ',left='+ leftPos +',top=' + topPos + ', status=no, resizable=yes, scrollbars=yes');
}
function MemberContactFormValidation(form,LANG) {
	name = form.full_name.value;
	phone = form.phone.value;
	
	if (!name) {
		if (LANG=='gr') {
			alert("Δώστε το ονοματεπωνυμό σας");
		} else {
			alert("Please enter your full name");
		}
		return false;
	} else if (!phone) {
		if (LANG=='gr') {
			alert("Δώστε το τηλεφωνό σας");
		} else {
			alert("Please enter your phone number");
		}
		return false;
	} else {
		return true;
	}
}
function SearchFormValidation(form) {
	fy = parseInt(form.fsearch_con_year.value);
	ty = parseInt(form.tsearch_con_year.value);
	
	fpr = parseInt(form.search_fprice.value);
	tpr = parseInt(form.search_tprice.value);
	 
	if ((fy > ty)&&(fy!='')&&(ty!='')) {
		alert("Σφάλμα στην επιλογή έτους κατασκευής...");
		return false;
	} else if ((fpr > tpr)&&(fpr!='')&&(tpr!='')) {
		alert("Σφάλμα στην επιλογή τιμής...");
		return false;
	} else {
		return true;
	}
}
function ComingSoonWarning(){
	alert("Σύντομα κοντά σας...");
}
function SearchAccessoriesFormValidation(form) {
	fpr = parseInt(form.search_fprice.value);
	tpr = parseInt(form.search_tprice.value);
	 
	if ((fpr > tpr)&&(fpr!='')&&(tpr!='')) {
		alert("Σφάλμα στην επιλογή τιμής...");
		return false;
	} else {
		return true;
	}
}
function ShowAccessoryPhotoPopUp(ImgId) {
	var w = 500, h = 350;
	
	if (document.all || document.layers) {
   		w = screen.availWidth;
   		h = screen.availHeight;
	}

	var popW = 700, popH = 600;
	var leftPos = (w-popW)/2, topPos = (h-popH)/2;

  window.ACCESRYPHOTOPOPUP = open('accessory_photo.php?img_id=' + ImgId, 'ACCESRYPHOTOPOPUP', 'width=' + popW + ',height=' + popH + ',left='+ leftPos +',top=' + topPos + ', status=no, resizable=yes, scrollbars=yes');
}

function SearchBicycleFormValidation(form) {
	fpr = parseInt(form.search_fprice.value);
	tpr = parseInt(form.search_tprice.value);
	 
	if ((fpr > tpr)&&(fpr!='')&&(tpr!='')) {
		alert("Σφάλμα στην επιλογή τιμής...");
		return false;
	} else {
		return true;
	}
}

function ShowBicyclePhotoPopUp(ImgId) {
	var w = 500, h = 350;
	
	if (document.all || document.layers) {
   		w = screen.availWidth;
   		h = screen.availHeight;
	}

	var popW = 700, popH = 600;
	var leftPos = (w-popW)/2, topPos = (h-popH)/2;

  window.BICYCLEPHOTOPOPUP = open('bicycle_photo.php?img_id=' + ImgId, 'BICYCLEPHOTOPOPUP', 'width=' + popW + ',height=' + popH + ',left='+ leftPos +',top=' + topPos + ', status=no, resizable=yes, scrollbars=yes');
}
function SearchBicycleFormValidation(form) {
	fpr = parseInt(form.search_fprice.value);
	tpr = parseInt(form.search_tprice.value);
	 
	if ((fpr > tpr)&&(fpr!='')&&(tpr!='')) {
		alert("Σφάλμα στην επιλογή τιμής...");
		return false;
	} else {
		return true;
	}
}

function ShowJetskiPhotoPopUp(ImgId) {
	var w = 500, h = 350;
	
	if (document.all || document.layers) {
   		w = screen.availWidth;
   		h = screen.availHeight;
	}

	var popW = 700, popH = 600;
	var leftPos = (w-popW)/2, topPos = (h-popH)/2;

  window.JETSKIPHOTOPOPUP = open('jetski_photo.php?img_id=' + ImgId, 'JETSKIPHOTOPOPUP', 'width=' + popW + ',height=' + popH + ',left='+ leftPos +',top=' + topPos + ', status=no, resizable=yes, scrollbars=yes');
}

function changeLoc(newloc) {
 location.replace(newloc);
}
function SearchPartAdsFormValidation(form,lang) {
	fpr = parseInt(form.search_fprice.value);
	tpr = parseInt(form.search_tprice.value);
	fye = parseInt(form.fsearch_con_year.value);
	tye = parseInt(form.tsearch_con_year.value);
	 
	if ((fpr > tpr)&&(fpr!='')&&(tpr!='')) {
		if (lang == 'gr') {
			alert("Σφάλμα στην επιλογή τιμής...");
		} else {
			alert("Error in price range...");
		}
		return false;
	} else if ((fye > tye)&&(fye!='')&&(tye!='')) {
		if (lang == 'gr') {
			alert("Σφάλμα στην επιλογή έτους...");
		} else {
			alert("Error in year range...");
		}
		return false;
	} else {
		return true;
	}
}


function ClearField(FIELD) {
	VAL = document.getElementById(FIELD).value;
	if ((VAL == 'Min')||(VAL == 'Max')) {
		document.getElementById(FIELD).value="";
	}
}

function ShowBoatPhotoPopUp(ImgId) {
	var w = 500, h = 350;
	
	if (document.all || document.layers) {
   		w = screen.availWidth;
   		h = screen.availHeight;
	}

	var popW = 700, popH = 600;
	var leftPos = (w-popW)/2, topPos = (h-popH)/2;

  window.BOATPHOTOPOPUP = open('boat_photo.php?img_id=' + ImgId, 'BOATPHOTOPOPUP', 'width=' + popW + ',height=' + popH + ',left='+ leftPos +',top=' + topPos + ', status=no, resizable=yes, scrollbars=yes');
}

function layer() {
	setTimeout("document.getElementById('pop').style.visibility='hidden'",95000);
}

function SEND_PAGE_TO_FRIEND(myurl, lang) {
	
 var url = window.location.toString();
 url.match(/\?(.+)$/);
 var params = RegExp.$1;
 var params = params.split("&");
 var queryStringList = {};
 
 var total_params = params.length;
 for(var i=0;i<params.length;i++) {
     var tmp = params[i].split("=");
     queryStringList[tmp[0]] = unescape(tmp[1]);
 }
 var parameters = "";
 var counter = 0;
 if (total_params > 0) {
// parameters = "?";
	 for(var i in queryStringList) {
		if (queryStringList[i] != 'undefined') {
			if (counter != 0) {
				parameters = parameters+"&";
			}
			parameters = parameters+i+"="+queryStringList[i];
			counter++;
		}
	 }
 }
	
	
	var w = 1024, h = 768;
	
	if (document.all || document.layers) {
   		w = screen.availWidth;
   		h = screen.availHeight;
	}

	var popW = 500, popH = 230;
	var leftPos = (w-popW)/2, topPos = (h-popH)/2;

  window.SENDPAGE = open('../web_tools/sendpage.php?'+parameters+'&wlang='+lang, 'SENDPAGE', 'width=' + popW + ',height=' + popH + ',left='+ leftPos +',top=' + topPos + ', status=no, resizable=no, scrollbars=no');
}
function PRINT_PAGE(PageCase, lang) {
	
	 var url = window.location.toString();
	 url.match(/\?(.+)$/);
	 var params = RegExp.$1;
	 var params = params.split("&");
	 var queryStringList = {};
	 
	 var total_params = params.length;
	 for(var i=0;i<params.length;i++) {
		 var tmp = params[i].split("=");
		 queryStringList[tmp[0]] = unescape(tmp[1]);
	 }
	 var parameters = "";
	 var counter = 0;
	 if (total_params > 0) {
	// parameters = "?";
		 for(var i in queryStringList) {
			if (queryStringList[i] != 'undefined') {
				if (counter != 0) {
					parameters = parameters+"&";
				}
				parameters = parameters+i+"="+queryStringList[i];
				counter++;
			}
		 }
	 }
	
	var w = 1024, h = 768;
	
	if (document.all || document.layers) {
   		w = screen.availWidth;
   		h = screen.availHeight;
	}

	var popW = 750, popH = 500;
	var leftPos = (w-popW)/2, topPos = (h-popH)/2;

  window.PRINTPAGE = open('../web_tools/printpage.php?'+parameters+'&case='+PageCase+'&wlan='+lang, 'PRINTPAGE', 'width=' + popW + ',height=' + popH + ',left='+ leftPos +',top=' + topPos + ', status=no, resizable=yes, scrollbars=yes');
}

function REFRESH_MONTHS(WLAN,SHOW_CLICKS){
	
var AJAX_REQUEST; 
var SELECTED_YEAR = document.getElementById("year_f").value;
document.getElementById("mnt_loading").style.display = "block";
document.getElementById("mnt_list").style.display = "none";

try { AJAX_REQUEST = new XMLHttpRequest();
} catch (e){
try { AJAX_REQUEST = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try { AJAX_REQUEST = new ActiveXObject("Microsoft.XMLHTTP");
} catch (e){
	alert("Something is wrong with your browser!");
	return false;
}
}
}

AJAX_REQUEST.onreadystatechange = function(){
if(AJAX_REQUEST.readyState == 4){
var ajaxDisplay = document.getElementById("YEAR_MONTHS");
ajaxDisplay.innerHTML = AJAX_REQUEST.responseText;
}
}
AJAX_REQUEST.open("GET", "refresh_months.php?year_s="+SELECTED_YEAR+"&wlan="+WLAN+"&show_c="+SHOW_CLICKS, true);
AJAX_REQUEST.send(null); 
}

function REFRESH_THUMBS_AREA(SHOW_CLICKS){
	
var AJAX_REQUEST; 
var SELECTED_MONTH = document.getElementById("month_f").value;
var SELECTED_YEAR = document.getElementById("year_f").value;
if ((SELECTED_MONTH != '')&&(SELECTED_YEAR != '')) {

document.getElementById("RefreshMessage").style.display = "block";
document.getElementById("THUMBS_VIEW").style.display = "none";
	
try { AJAX_REQUEST = new XMLHttpRequest();
} catch (e){
try { AJAX_REQUEST = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try { AJAX_REQUEST = new ActiveXObject("Microsoft.XMLHTTP");
} catch (e){
	alert("Something is wrong with your browser!");
	return false;
}
}
}

AJAX_REQUEST.onreadystatechange = function(){
if(AJAX_REQUEST.readyState == 4){
var ajaxDisplay = document.getElementById("ThumbPhotos");
ajaxDisplay.innerHTML = AJAX_REQUEST.responseText;
}
}

AJAX_REQUEST.open("GET", "refresh_thumbs.php?month_s="+SELECTED_MONTH+"&year_s="+SELECTED_YEAR+"&show_c="+SHOW_CLICKS, true);
AJAX_REQUEST.send(null);
}
}

function REFRESH_GALLERY_AREA(GALLERY_ID){
	
var AJAX_REQUEST_GAL; 
document.getElementById("RefreshGalleryMsg").style.display = "block";
document.getElementById("DISPLAY_PHOTOS").style.display = "none";

try { AJAX_REQUEST_GAL = new XMLHttpRequest();
} catch (e){
try { AJAX_REQUEST_GAL = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try { AJAX_REQUEST_GAL = new ActiveXObject("Microsoft.XMLHTTP");
} catch (e){
alert("Something is wrong with your browser!");
return false;
}
}
}

AJAX_REQUEST_GAL.onreadystatechange = function(){
if(AJAX_REQUEST_GAL.readyState == 4){
var ajaxDisplay = document.getElementById("GALLERY_PHOTO_AREA");
ajaxDisplay.innerHTML = AJAX_REQUEST_GAL.responseText;
}
}

AJAX_REQUEST_GAL.open("GET", "refresh_gallery.php?gal_id="+GALLERY_ID, true);
AJAX_REQUEST_GAL.send(null); 
}

function SelectImgOLD(FileName, id) {

	//document.getElementById("thumb_"+id).className = "thumbSelected";
	document.getElementById("normal_photo").src = "../web_images/gallery/"+FileName;
}

function SelectImgOLD(FileName, id) {
	var big_photo_loc = document.getElementById("m_photo");
	if (big_photo_loc.style.display != "block") {
		c.innerHTML = '<img src="../web_images/gallery/' + FileName + '" border="0" width="380">';
	}
}

function PRELOAD_IMAGES(IMG_NAME, IMG_W, IMG_H) {
	var IMG_W_NUM = parseInt(IMG_W);
	var IMG_H_NUM = parseInt(IMG_H);
	
	Image1= new Image(IMG_W_NUM,IMG_H_NUM);
	Image1.src = "../web_images/gallery/"+IMG_NAME;
}


function SelectImg(FileName, id) {

	var subImages = document.getElementById('previewPane').getElementsByTagName('IMG');
	if(subImages.length==0){
		var img = document.createElement('IMG');
		document.getElementById('previewPane').appendChild(img);
	} else img = subImages[0];
	
	document.getElementById('waitMessage').style.display='inline';
	img.onload = function() { document.getElementById('waitMessage').style.display='none'; };

	img.src = "../web_images/gallery/"+FileName;
	img.width = 380;

	//document.getElementById("normal_photo").src = "../web_images/gallery/"+FileName;
}

