function framepage(page_name)
{
	var frameg = document.getElementById("frame_gallery");
	frameg.src = page_name;
}
function commrecial_send()
{
	
var themessage = "Morate da popunite sledeća polja: ";
if (!ExistNonWhiteSpace(document.form_change.name.value)) {
themessage = themessage + " - Ime";
}
if (!ExistNonWhiteSpace(document.form_change.surname.value)) {
themessage = themessage + " - Prezime";
}
if (!ExistNonWhiteSpace(document.form_change.mob.value)) {
themessage = themessage + " - Broj mob. telefona";
}
if (!ExistNonWhiteSpace(document.form_change.address.value)) {
themessage = themessage + " -  Adresa";
}
if (!ExistNonWhiteSpace(document.form_change.email.value)) {
themessage = themessage + " -  Email";
}

if (themessage == "Morate da popunite sledeća polja: ") {

if (echeck(document.form_change.email.value)) {
document.form_change.submit();

}
}
else {
  alert(themessage);
return false;
   }
}

function echeck(str) {

		var at="@"
		var dot="."
		var lat=str.indexOf(at)
		var lstr=str.length
		var ldot=str.indexOf(dot)
		if (str.indexOf(at)==-1){
		   alert("Nepravilna e-mail adresa.")
		   return false
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		   alert("Nepravilna e-mail adresa.")
		   return false
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		    alert("Nepravilna e-mail adresa.")
		    return false
		}

		 if (str.indexOf(at,(lat+1))!=-1){
		    alert("Nepravilna e-mail adresa.")
		    return false
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		    alert("Nepravilna e-mail adresa.")
		    return false
		 }

		 if (str.indexOf(dot,(lat+2))==-1){
		    alert("Nepravilna e-mail adresa.")
		    return false
		 }
		
		 if (str.indexOf(" ")!=-1){
		    alert("Nepravilna e-mail adresa.")
		    return false
		 }

 		 return true					
	}
function ExistNonWhiteSpace(test_string)
{
var regExp=/[A-a-0-9\-_\.,]/ 
if (!regExp.test(test_string))
{    
return false;
}
else 
{
return true;
}
}
function verifyForgotPass() 
{
var themessage = "Morate da popunite sledeća polja: ";
if (!ExistNonWhiteSpace(document.form_change.name.value)) 
{
themessage = themessage + " - Korisničko ime";
}
if (themessage == "Morate da popunite sledeća polja: ") 
 {
if (echeck(document.form_change.email.value)) 
{
document.form_change.submit();
}
}
else {
  alert(themessage);
return false;
   }
}

function verifyContact() 
{

var themessage = "Morate da popunite sledeća polja: ";
if (!ExistNonWhiteSpace(document.form_change.name.value)) {
themessage = themessage + " - Ime i prezime";
}
if (!ExistNonWhiteSpace(document.form_change.phone.value)) {
themessage = themessage + " - Broj telefona";
}
if (!ExistNonWhiteSpace(document.form_change.title.value)) {
themessage = themessage + " -  Naslov";
}
if (!ExistNonWhiteSpace(document.form_change.email.value)) {
themessage = themessage + " -  Email";
}
if (!ExistNonWhiteSpace(document.form_change.message.value)) {
themessage = themessage + " -  Poruka";
}
if (!ExistNonWhiteSpace(document.form_change.code_captcha.value)) {
themessage = themessage + " - Kod sa slike";
}
if (themessage == "Morate da popunite sledeća polja: ") {

if (echeck(document.form_change.email.value)) {
document.form_change.submit();

}
}
else {
  alert(themessage);
return false;
   }
}



function verifyRegister() 
{
var themessage = "Morate da popunite sledeća polja: ";
if (!ExistNonWhiteSpace(document.form_change.name.value)) {
themessage = themessage + " - Ime";
}
if (!ExistNonWhiteSpace(document.form_change.surname.value)) {
themessage = themessage + " - Prezime";
}
if (!ExistNonWhiteSpace(document.form_change.pass1.value)) {
themessage = themessage + " -  Lozinka";
}
if (!ExistNonWhiteSpace(document.form_change.pass2.value)) {
themessage = themessage + " -  Potvrda lozinke";
}
if (!ExistNonWhiteSpace(document.form_change.company_slug.value)) {
themessage = themessage + " - Unikatna adresa";
}
if (!ExistNonWhiteSpace(document.form_change.company.value)) {
themessage = themessage + " - Naziv klijenta";
}

if (!ExistNonWhiteSpace(document.form_change.phone.value)) {
themessage = themessage + " - Telefon";
}
if (!ExistNonWhiteSpace(document.form_change.code_captcha.value)) {
themessage = themessage + " - Kod sa slike";
}

if (document.form_change.pass1.value != document.form_change.pass2.value){
themessage = "Unešene lozinke moraju biti jednake.";	
}


//if
//alert if fields are empty and cancel form submit
if (themessage == "Morate da popunite sledeća polja: ") {
if (echeck(document.form_change.email.value)) {
document.form_change.submit();

}
}
else {
  alert(themessage);
return false;
   }
}

function newwindow(img){
image= new Image();
image.src=(img);
openWindow(img);
}

function openWindow(img){
if((image.width!=0)&&(image.height!=0)){
viewImage(img);
}
else{
stuff="openWindow('"+img+"')";
stuff1=setTimeout(stuff,20);
}
}
function viewImage(img){
w=image.width+0;
h=image.height+0;
dims="width="+w+",height="+h;
result=window.open(img,"",dims);
}


function Load() { 

if ( navigator.appName == "Netscape" ) 
{ 
navigator.plug-ins.refresh(); 
document.write("\x3C" + "applet MAYscript Code=NPDS.npDSEvtObsProxy.class") 
document.writeln(" width=5 height=5 name=appObs\x3E \x3C/applet\x3E") 
} 

}


function genSEF(from,to) { 
		
			var str = from.value.toLowerCase();
			str = str.replace('š','s');
			str = str.replace('č','c');
			str = str.replace('ć','c');
			str = str.replace('ž','z');
			str = str.replace(/[^a-z 0-9]+/g,'');
			str = str.replace(/\s+/g, "-");		
			to.value = str;
		
}