
function SearchTop(){
	document.frmIndex.submit();
}

function checkformF(){
	if(document.frmSignup.userid.value.search(/\S/)==-1){
		alert("Vnesite uporabniško ime.");
		document.frmSignup.userid.focus();
		return false;
	}
    if(document.frmSignup.fname.value.search(/\S/)==-1){
		alert("Vnesite ime.");
		document.frmSignup.fname.focus();
		return false;
	}
	if(document.frmSignup.lname.value.search(/\S/)==-1){
		alert("Vnesite priimek.");
		document.frmSignup.lname.focus();
		return false;
	}
	if(document.frmSignup.address_1.value.search(/\S/)==-1){
		alert("Vnesite vaš naslov v prvo polje za naslov.");
		document.frmSignup.address_1.focus();
		return false;
	}
	if((/^[a-zA-Z0-9._-]+@([a-zA-Z0-9.-]+\.)+[a-zA-Z]{2,5}$/).exec(document.frmSignup.email_add.value)==null){
		alert("Vnesite veljaven e-mail");
		document.frmSignup.email_add.focus();
		return false;
	}
	if(document.frmSignup.password.value.search(/\S/)==-1){
		alert("Vnesite geslo.");
		document.frmSignup.password.focus();
		return false;
	}
	if(document.frmSignup.password_confirm.value.search(/\S/)==-1){
		alert("Potrdite geslo.");
		document.frmSignup.password_confirm.focus();
		return false;
	}	
	if(document.frmSignup.password.value != document.frmSignup.password_confirm.value ){
		alert("Vnesite enako geslo.");
		document.frmSignup.password_confirm.focus();
		return false;
	}
	if(document.frmSignup.cgender[0].checked){
		document.frmSignup.gender.value="M";
	}
	else if(document.frmSignup.cgender[1].checked){
		document.frmSignup.gender.value="F";
	}	
	if(document.frmSignup.country_id.value==""){
		alert("Izberite državo.");
		document.frmSignup.country_id.focus();
		return false;
	}
	if((document.frmSignup.birth_dd.value=="") || (document.frmSignup.birth_mm.value=="") || (document.frmSignup.birth_yy.value=="")){
		alert("Prosimo vnesite datum rojstva.");
		document.frmSignup.birth_dd.focus();
		return false;
	}
	if(document.frmSignup.country_id.value=="226" && document.frmSignup.state_id.value==""){
		alert("Izberite regijo.");
		document.frmSignup.state_id.focus();
		return false;
	}
    if(document.frmSignup.move_month.value==""){


        if(document.frmSignup.move.checked==""){
    		alert("Če ne nameravate kupiti nepremičnine v bližnji prihodnosti, to prosimo označite..");
    		document.frmSignup.move.focus();
    		return false;
    	}

    }
}

function checkformFEdit(){
	if(document.frmSignup.userid.value.search(/\S/)==-1){
		alert("Vnesite uporabniško ime.");
		document.frmSignup.userid.focus();
		return false;
	}
    if(document.frmSignup.fname.value.search(/\S/)==-1){
		alert("Vnesite ime.");
		document.frmSignup.fname.focus();
		return false;
	}
	if(document.frmSignup.lname.value.search(/\S/)==-1){
		alert("Vnesite priimek.");
		document.frmSignup.lname.focus();
		return false;
	}
	if(document.frmSignup.address_1.value.search(/\S/)==-1){
		alert("Vnesite vaš e-mail v prvo polje za e-mail.");
		document.frmSignup.address_1.focus();
		return false;
	}
	if((/^[a-zA-Z0-9._-]+@([a-zA-Z0-9.-]+\.)+[a-zA-Z]{2,5}$/).exec(document.frmSignup.email_add.value)==null){
		alert("Vnesite veljaven e-mail");
		document.frmSignup.email_add.focus();
		return false;
	}


	if(document.frmSignup.cgender[0].checked){
		document.frmSignup.gender.value="M";
	}
	else if(document.frmSignup.cgender[1].checked){
		document.frmSignup.gender.value="F";
	}	
	if(document.frmSignup.country_id.value==""){
		alert("Izberite državo.");
		document.frmSignup.country_id.focus();
		return false;
	}
	if(document.frmSignup.country_id.value=="226" && document.frmSignup.state_id.value==""){
		alert("Izberite regijo.");
		document.frmSignup.state_id.focus();
		return false;
	}
    if(document.frmSignup.move_month.value==""){
        if(document.frmSignup.move.checked==""){
    		alert("Če nepremičnin ne nameravate kupovati v bližnji prihodnosti, to prosimo obkljukajte.");
    		document.frmSignup.move.focus();
    		return false;
    	}

    }
}

function checkform(){
	if(document.frmSignup.userid.value.search(/\S/)==-1){
		alert("Vnesite vaše uporabniško ime.");
		document.frmSignup.userid.focus();
		return false;
	}
    if(document.frmSignup.fname.value.search(/\S/)==-1){
		alert("Vnesite vaše ime.");
		document.frmSignup.fname.focus();
		return false;
	}
	if(document.frmSignup.lname.value.search(/\S/)==-1){
		alert("Vnesite vaš priimek.");
		document.frmSignup.lname.focus();
		return false;
	}
	if(document.frmSignup.address_1.value.search(/\S/)==-1){
		alert("Vnesite vaš naslov v prvo polje za naslov");
		document.frmSignup.address_1.focus();
		return false;
	}
	if((/^[a-zA-Z0-9._-]+@([a-zA-Z0-9.-]+\.)+[a-zA-Z]{2,5}$/).exec(document.frmSignup.email_add.value)==null){
		alert("Vnesite veljaven email");
		document.frmSignup.email_add.focus();
		return false;
	}
	if(document.frmSignup.password.value.search(/\S/)==-1){
		alert("Vnesite geslo.");
		document.frmSignup.password.focus();
		return false;
	}
	if(document.frmSignup.password_confirm.value.search(/\S/)==-1){
		alert("Potrdite geslo.");
		document.frmSignup.password_confirm.focus();
		return false;
	}	
	if(document.frmSignup.password.value != document.frmSignup.password_confirm.value ){
		alert("Vnesite geslo.");
		document.frmSignup.password_confirm.focus();
		return false;
	}
	
	if(document.frmSignup.country_id.value==""){
		alert("Vnesite državo.");
		document.frmSignup.country_id.focus();
		return false;
	}
	if(document.frmSignup.country_id.value=="226" && document.frmSignup.state_id.value==""){
		alert("Vnesite regijo.");
		document.frmSignup.state_id.focus();
		return false;
	}

}

function checkformEdit(){
	if(document.frmSignup.userid.value.search(/\S/)==-1){
		alert("Vnesite uporabniško ime.");
		document.frmSignup.userid.focus();
		return false;
	}
    if(document.frmSignup.fname.value.search(/\S/)==-1){
		alert("Vnesite ime.");
		document.frmSignup.fname.focus();
		return false;
	}
	if(document.frmSignup.lname.value.search(/\S/)==-1){
		alert("Vnesite priimek.");
		document.frmSignup.lname.focus();
		return false;
	}
	if(document.frmSignup.address_1.value.search(/\S/)==-1){
		alert("Vnesite vaš naslov v prvo polje za naslov.");
		document.frmSignup.address_1.focus();
		return false;
	}
	if((/^[a-zA-Z0-9._-]+@([a-zA-Z0-9.-]+\.)+[a-zA-Z]{2,5}$/).exec(document.frmSignup.email_add.value)==null){
		alert("Vnesite veljaven email.");
		document.frmSignup.email_add.focus();
		return false;
	}
	if(document.frmSignup.country_id.value==""){
		alert("Izberite državo.");
		document.frmSignup.country_id.focus();
		return false;
	}
	if(document.frmSignup.country_id.value=="226" && document.frmSignup.state_id.value==""){
		alert("Izberite regijo.");
		document.frmSignup.state_id.focus();
		return false;
	}

}

function Login(){
	if(document.frmSignup.userid.value==''){
		alert("Vnesite veljavno uporabniško ime");
		document.frmSignup.userid.focus();
		return false;
	}
	if(	document.frmSignup.password.value.search(/\S/)==-1) {
		alert('Vnesite geslo');
		document.frmSignup.password.focus();
		return false;
	}
	document.frmSignup.hidaction.value="login";
	document.frmSignup.submit();
}

function Search(){
	document.frmEditSearch.hidaction.value="editSearch";
	document.frmEditSearch.submit();
}
function selectcountryS(){
	document.frmEditSearch.action="edit_search.php";
	document.frmEditSearch.submit();
}


function SearchInclude(){
	document.frmSearch.submit();
}

function SearchTop(){
	document.frmTop.submit();
}

function rowsshown(){
	document.frmPage.submit();
}

function chFrmS(){
	if(	document.frmSearchList.savesearch_name.value.search(/\S/)==-1) {
		alert('Vnesite ime iskanja');
		document.frmSearchList.savesearch_name.focus();
		return false;
	}
    opener.document.frmPage.savesearch_name.value = document.frmSearchList.savesearch_name.value;
	opener.document.frmPage.hidaction.value = "SaveSearchListing";
	opener.document.frmPage.submit();
    window.close();
}  

function chFrm(){
	if(	document.frmListing.list_name.value.search(/\S/)==-1) {
		alert('Vnesite ime lista');
		document.frmListing.list_name.focus();
		return false;
	}
    opener.document.frmdetail.list_name.value = document.frmListing.list_name.value;
 opener.document.frmdetail.hidaction.value = "SaveListing";
	opener.document.frmdetail.submit();
    window.close();
}  

function checkformP(Frm){

    if(document.frmAddEdit.country_id.value==""){
		alert("Izberite državo.");
		document.frmAddEdit.country_id.focus();
		return false;
	}		
	if(document.frmAddEdit.country_id.value=="226" && document.form.state_id.value==""){
		alert("Vnesite regijo.");
		document.frmAddEdit.state_id.focus();
		return false;
	}
    if(document.frmAddEdit.city.value==""){
		alert("Vnesite mesto.");
		document.frmAddEdit.city.focus();
		return false;
	}
	if(document.frmAddEdit.zip.value==""){
		alert("Vnesite poštno številko.");
		document.frmAddEdit.zip.focus();
		return false;
	}
	return true;
}
function selectcountry(){
	document.frmAddEdit.action="property_add.php";
	document.frmAddEdit.submit();
}

function change_image(num,pic,wpic,hpic,path){
	document.frmdetail.slide.src=path+pic;
    document.frmdetail.slide.width=wpic;
    document.frmdetail.slide.height=hpic;
}
function callBrochure(id){
	window.open('brochure.php?property_id='+id,'Brochure','toolbar=0,scrollbars=1,location=no,statusbar=0,menubar=0,resizable=1,height=630,width=565,top=10,left=10');
}
function openSaveListing(id){
	window.open('openSaveListing.php?property_id='+id,'SaveListing','toolbar=0,scrollbars=1,location=no,statusbar=0,menubar=0,resizable=1,height=300,width=565,top=10,left=10');
}
function openSearchListing(id){
	window.open('openSearchListing.php?property_id='+id,'SaveSearchListing','toolbar=0,scrollbars=1,location=no,statusbar=0,menubar=0,resizable=1,height=300,width=565,top=10,left=10');
}
function sendMail(id){
	window.open('sendMail.php?property_id='+id,'Sendmail','toolbar=0,scrollbars=1,location=no,statusbar=0,menubar=0,resizable=1,height=420,width=565,top=10,left=10');
}

function send(){
	if(	document.frmContact.fname.value.search(/\S/)==-1) {
		alert('Vnesite ime');
		document.frmContact.fname.focus();
		return false;
	}
	if(	document.frmContact.lname.value.search(/\S/)==-1) {
		alert('Vnesite priimek');
		document.frmContact.lname.focus();
		return false;
	}
	if((/^[a-zA-Z0-9._-]+@([a-zA-Z0-9.-]+\.)+[a-zA-Z]{2,5}$/).exec(document.frmContact.email.value)==null){
		alert("Vnesite veljaven e-mail za prijavo");
		document.frmContact.email.focus();
		return false;
	}
	document.frmContact.pageaction.value="submitform";
	document.frmContact.submit();	
}

function checkformFriend(){
	if(	document.frmMail.your_name.value.search(/\S/)==-1) {
		alert('Vnesite ime');
		document.frmMail.your_name.focus();
		return false;
	}
	if(	document.frmMail.friend_name.value.search(/\S/)==-1) {
		alert('Vnesite prijateljevo ime');
		document.frmMail.friend_name.focus();
		return false;
	}
	if(	document.frmMail.subject.value.search(/\S/)==-1) {
		alert('Vnesite temo');
		document.frmMail.subject.focus();
		return false;
	}
	if(	document.frmMail.message.value.search(/\S/)==-1) {
		alert('Vnesite sporočilo');
		document.frmMail.message.focus();
		return false;
	}
	if((/^[a-zA-Z0-9._-]+@([a-zA-Z0-9.-]+\.)+[a-zA-Z]{2,5}$/).exec(document.frmMail.your_email.value)==null){
		alert("Vnesite veljaven e-mail.");
		document.frmMail.your_email.focus();
		return false;
	}
	if((/^[a-zA-Z0-9._-]+@([a-zA-Z0-9.-]+\.)+[a-zA-Z]{2,5}$/).exec(document.frmMail.friend_email.value)==null){
		alert("Vnesite veljaven e-mail vašega prijatelja");
		document.frmMail.friend_email.focus();
		return false;
	}

	document.frmMail.submit();
}
function openWindow(obj,wd,ht){

	features = "width="+wd+",height="+ht;      
	features += ",left=10,top=10,screenX=0,screenY=0,location=no,toolbar=no,menubar=no,status=no,scrollbars=no,resizable=no";
	webwindow=window.open(obj, 'webwindow1', features);
	if (parseInt(navigator.appVersion) >= 4) { 
		webwindow.window.focus(); 
	}
}

function notify() {
	pmbox=confirm("Opozorilo: Res želite izbrisati to?");
	if (pmbox==true) { // Output when OK is clicked
		return;
	} else {
	// Output when Cancel is clicked
	return false;
	}
}

function uncheckSingle(formName,field) {
	var ChckBxs = formName.elements[field];
	if(ChckBxs.length!=-1) {
		for (i = 0; i < ChckBxs.length; i++){
			if(ChckBxs[i].value=="99")
				ChckBxs[i].checked = false ;
		}
		formName.elements[field].checked = false;
	}
}

