<!--
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}



//-->

function MM_ClickImage() { //v3.0
  var i,j=0,x,a=MM_ClickImage.arguments; 
  document.MM_sr=new Array; 
  for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){
      document.MM_sr[j++]=x; 
      if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];
   }  
 return false;   
}


function openWin($url) {
  msgWindow= window.open($url,"displayWindow","width=780,height=600,status=no,toolbar=no,menubar=no,scrollbars=yes");
}
function closeIt(){
  window.close();
}

/*
function viewform(m, w, h) {
   alert("message");
   var scroll = 'yes';
   var settings;
   var LeftPosition;
   var TopPosition;
   var win; 
   
   alert("message");
   exit;
         
   LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
   TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
  
   settings = 'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll;
   settings = settings + ',resizable=no,maximize=no,status=no,toolbar=no,directories=no,menubar=no,location=no';
            
   win = window.open(m, 'pre', settings);
   win.name = 'name';
   win.focus();

}
*/
function viewformclose(m, w, h) {
   
   var scroll = 'yes';
   var settings;
   var LeftPosition;
   var TopPosition;
   var win;

   LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
   TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
  
   settings = 'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll;
   settings = settings + ',resizable=no,maximize=no,status=no,toolbar=no,directories=no,menubar=no,location=no';
            
   win = window.open(m, 'pre', settings);
   win.name = 'name';
   win.focus();
   win.alert('!!!!!');
   win.document.write('window.close();');
}
function viewform2(m, w, h) {
//   var w = 300;
//   var h = 380;
   var scroll = 'yes';
   var settings;
   var LeftPosition;
   var TopPosition;
   var win;
         
   LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
   TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
  
   settings = 'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll;
   settings = settings + ',resizable=no,maximize=no,status=no,toolbar=no,directories=no,menubar=no,location=no';
            
   win = window.open(m, 'pre', settings);
   win.name = 'name';
   win.focus();
}
function viewformi(m, w, h,r) {
   var scroll = 'yes';
   var settings;
   var LeftPosition;
   var TopPosition;
   var win;
         
   LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
   TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
   if (r=='')
      r='no';
   settings = 'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll;
   settings = settings + ',resizable='+ r + ',maximize=yes,status=no,toolbar=no,directories=no,menubar=no,location=no';
            
   win = window.open(m, 'pre', settings);
   win.name = 'name';
   win.focus();
}
function ViewOtherImg(name,main) {

   tmp_src = document.images[main].src;
   document.images[main].src = document.images[name].src;
   document.images[name].src = tmp_src;   
  
}            

function conf() {
  var reply = confirm('This record will be permanently deleted. Do you want to continue?');

  if(reply) {
     return true;
   } else {
     return false;
   }
}                         

function confirm_delete() {
  var reply = confirm('This record will be permanently deleted. Do you want to continue?');

  if(reply) {
     return true;
   } else {
     return false;
   }
}                         

function confirm_del_album() {
  var reply = confirm('This album with all images will be permanently deleted. Do you want to continue?');

  if(reply) {
     return true;
   } else {
     return false;
   }
}                         

function confirm_del_image() {
  var reply = confirm('This image will be permanently deleted. Do you want to continue?');

  if(reply) {
     return true;
   } else {
     return false;
   }
}                         

function confirm_del_category() {
  var reply = confirm('This category with all albums and images will be permanently deleted. Do you want to continue?');

  if(reply) {
     return true;
   } else {
     return false;
   }
}                         

function confirm_del_site() {
  var reply = confirm('This site will be permanently deleted. Do you want to continue?');

  if(reply) {
     return true;
   } else {
     return false;
   }
}                         

opera = (navigator.userAgent.indexOf('Opera') >= 0)? true : false;
ie = (document.all && !opera)? true : false;
dom = (document.getElementById && !ie && !opera)? true : false;

var expiration = new Date();
expiration.setTime(expiration.getTime() + 3600*3600*3600);


function showtranscript(elemId,displayValue) {
  if (dom) {

      if (displayValue) {
         document.getElementById(elemId).style.display = displayValue;
         return 0;
      }

      if (document.getElementById(elemId).style.display == "none") {
         document.getElementById(elemId).style.display = "block";
      } else if (document.getElementById(elemId).style.display == "block") {
         document.getElementById(elemId).style.display = "none";
      } 
      
  } else if (ie) {

    if (displayValue) {
       document.all[elemId].style.display =  displayValue;
       return 0;
    }

    if (document.all[elemId].style.display == "block") {
       document.all[elemId].style.display = "none";
    } else if (document.all[elemId].style.display == "none") {
      document.all[elemId].style.display = "block";
    }

  }
}

function display(cookie_name, id) {
    var template_category_cookie;

    template_category_cookie = GetCookie(cookie_name);

    if (template_category_cookie) {
       SetCookie(cookie_name, "1", expiration, "", "","") 
       showtranscript(id, 'block');
    } else {
       SetCookie(cookie_name, "", expiration, "", "","") 
       showtranscript(id, 'none');
    }

    return true;                            
}


function onCookieChange(cookie_name, id) {
 
  if (dom) {
      if (document.getElementById(id).style.display == "none") {
         SetCookie(cookie_name, "", expiration, "", "","") 
      } else if (document.getElementById(id).style.display == "block") {
         SetCookie(cookie_name, "1", expiration, "", "","") 
      } 
      
  } else if (ie) {

    if (document.all[id].style.display == "block") {
       SetCookie(cookie_name, "1", expiration, "", "","") 
    } else if (document.all[id].style.display == "none") {
       SetCookie(cookie_name, "", expiration, "", "","") 
    }

  }
}


function SetCookie(name, value, expires, path, domain, secure) { 

   exit;
   var mycookie = name + "=" + escape(value);
   var myexpires = new Date();
   myexpires.setTime(myexpires.getTime() + 5000);
   mycookie = mycookie + "; myexpires=" + myexpires.toGMTString();
   document.cookie = mycookie;
}


function GetCookie(name) { 
   var arg = name + "="; 
   var alen = arg.length; 
   var clen = document.cookie.length; 
   var i = 0; 

   while (i < clen) { 
     var j = i + alen; 
     if (document.cookie.substring(i, j) == arg)  return getCookieVal (j); 
     i = document.cookie.indexOf(" ", i) + 1; 
     if (i == 0) break; 
   }
    
   return null; 
} 


function getCookieVal (offset) { 
  var endstr = document.cookie.indexOf (";", offset); 
  if (endstr == -1) endstr = document.cookie.length; 
   return unescape(document.cookie.substring(offset, endstr)); 
} 

function resize() {

var i=0;

var LeftPosition;

var TopPosition;

var w;

var h;

  if (navigator.appName == 'Netscape') i=40;

  if (document.images[0]) 

  {

    w = document.images[0].width+100;

    h = document.images[0].height+130-i;

    window.resizeTo(w, h);

    LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;

    TopPosition = (screen.height) ? (screen.height-h)/2 : 0;

    window.moveTo(LeftPosition, TopPosition); 

  }

  self.focus();

}

function viewform(m, w, h, scrol) {

   var scrolling = 'no';

   var settings;

   var LeftPosition;

   var TopPosition;

   var win;



   if (!scrol) scrol = 'no';



   LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;

   TopPosition = (screen.height) ? (screen.height-h)/2 : 0;

   settings = 'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scrol;

   if (scrol == 'no') settings = settings + ',resizable=no,maximize=no';

   if (scrol == 'yes') settings = settings + ',resizable=yes,maximize=yes';

   settings = settings + ',status=no,toolbar=no,directories=no,menubar=yes,location=no';


   win = window.open(m, 'pre', settings);

   win.name = 'name';

   win.focus();

}
function showlevel(id)
{
 //document.getElementById(id).style.display = "none";

 if (document.getElementById(id).style.display == "") {document.getElementById(id).style.display = "block"} else
 if (document.getElementById(id).style.display == "none") {document.getElementById(id).style.display = "block"} else
 if (document.getElementById(id).style.display == "block") {document.getElementById(id).style.display = "none"};
}

opera = (navigator.userAgent.indexOf('Opera') >= 0)? true : false;
ie = (document.all && !opera)? true : false;
dom = (document.getElementById && !ie && !opera)? true : false;

var expiration = new Date();
expiration.setTime(expiration.getTime() + 3600*3600*3600);

function showtranscript(elemId,displayValue) {
  if (dom) {

      if (displayValue) {
         document.getElementById(elemId).style.display = displayValue;
         return 0;
      }

      if (document.getElementById(elemId).style.display == "none") {
         document.getElementById(elemId).style.display = "block";
      } else if (document.getElementById(elemId).style.display == "block") {
         document.getElementById(elemId).style.display = "none";
      } 
      
  } else if (ie) {

    if (displayValue) {
       document.all[elemId].style.display =  displayValue;
       return 0;
    }

    if (document.all[elemId].style.display == "block") {
       document.all[elemId].style.display = "none";
    } else if (document.all[elemId].style.display == "none") {
      document.all[elemId].style.display = "block";
    }

  }
}



function opentranscript(elemId) {
  if (dom) {

     document.getElementById(elemId).style.display = "block";
      
  } else if (ie) {

     document.all[elemId].style.display = "block";
  }
  return true;
}


function closetranscript(elemId) {
  if (dom) {

     document.getElementById(elemId).style.display = "none";

  } 
      
   else if (ie) {

    document.all[elemId].style.display = "none";
  }
  return true;
}



function display(cookie_name, id) {
    var template_category_cookie;

    template_category_cookie = GetCookie(cookie_name);

    if (template_category_cookie) {
       SetCookie(cookie_name, "1", expiration, "", "","") 
       showtranscript(id, 'block');
    } else {
       SetCookie(cookie_name, "", expiration, "", "","") 
       showtranscript(id, 'none');
    }

    return true;                            
}


function onCookieChange(cookie_name, id) {
 
  if (dom) {
      if (document.getElementById(id).style.display == "none") {
         SetCookie(cookie_name, "", expiration, "", "","") 
      } else if (document.getElementById(id).style.display == "block") {
         SetCookie(cookie_name, "1", expiration, "", "","") 
      } 
      
  } else if (ie) {

    if (document.all[id].style.display == "block") {
       SetCookie(cookie_name, "1", expiration, "", "","") 
    } else if (document.all[id].style.display == "none") {
       SetCookie(cookie_name, "", expiration, "", "","") 
    }

  }
}


function SetCookie(name, value, expires, path, domain, secure) { 

   var mycookie = name + "=" + escape(value);
   var myexpires = new Date();
   myexpires.setTime(myexpires.getTime() + 5000);
   mycookie = mycookie + "; myexpires=" + myexpires.toGMTString();
   document.cookie = mycookie;
}


function GetCookie(name) { 
   var arg = name + "="; 
   var alen = arg.length; 
   var clen = document.cookie.length; 
   var i = 0; 

   while (i < clen) { 
     var j = i + alen; 
     if (document.cookie.substring(i, j) == arg)  return getCookieVal (j); 
     i = document.cookie.indexOf(" ", i) + 1; 
     if (i == 0) break; 
   }
    
   return null; 
} 


function getCookieVal (offset) { 
  var endstr = document.cookie.indexOf (";", offset); 
  if (endstr == -1) endstr = document.cookie.length; 
   return unescape(document.cookie.substring(offset, endstr)); 
} 

function doPreview(param1, param2) {

  if (dom) {
    var src = document.getElementById(param1).value; 
  } else if (ie) {
    var src = document.all[param1].value; 
  }

  if (src.charAt(1)==":") src = "file:/" + src;

  if (dom) {
    document.getElementById(param2).src=src; 
  } else if (ie) {
    document.all[param2].src = src; 
  }
 
}

function OnLoadPage() {

  if (document.mod_category) {
    var src  = mod_category.get_age; 
    var src1 = mod_category.get_search_age; 
      Change_prop(src,src1);

    var src  = mod_category.get_price_range; 
    var src1 = mod_category.get_search_price_range; 
      Change_prop(src,src1);

    var src  = mod_category.get_price; 
    var src1 = mod_category.get_search_price; 
      Change_prop(src,src1);

    var src  = mod_category.get_salary; 
    var src1 = mod_category.get_search_salary; 
      Change_prop(src,src1);

    var src  = mod_category.get_salary; 
    var src1 = mod_category.get_search_salary; 
      Change_prop(src,src1);

    var src  = mod_category.get_job_types; 
    var src1 = mod_category.get_search_job_types; 
      Change_prop(src,src1);

    var src  = mod_category.get_images; 
    var src1 = mod_category.get_search_images; 
      Change_prop(src,src1);
  }

}

function Change_prop(get_radio,search_radio) {

//  alert(get_radio);
//  var   
//    categoryCode = radio.value;
//  alert(get_radio.checked);
  if (get_radio.checked) {
    search_radio.disabled = false;
  } else {
      search_radio.checked  = false;
      search_radio.disabled = true;
    }
}

function ValidReg(frm){
   var prefix0 = 'get_';
   var input_array = new Array('first_name','phone_1','phone_2','phone_3','email');
   var error_array = new Array('First Name','Home Phone','Home Phone','Home Phone','Email Address');
	//alert("test");
   for (var i=0; i<input_array.length; i++) {
      var source = prefix0+input_array[i];          
      if (frm.elements[source].value.length == 0) {
         alert(error_array[i].substr(0,1).toUpperCase()+error_array[i].substr(1)+' can not be empty ');
		 
         frm.elements[source].focus();
         return false;
		 
	     }
		 
		/* if (input_array[i]=='phone_1' || input_array[i]=='phone_2' || input_array[i]=='phone_3')
		 {
			 ninp[] = input_array[i];
		 }
		 
		 if (ninp.length >= 3)
		 {
			 alert("test");
		 }
		 
*/		 if (input_array[i]=='email' && echeck(frm.elements[source].value)==false)
		 {
			 	frm.elements[source].focus();
				return false;
		 }

   } 
  
   
   phone = frm.elements['get_phone_1'].value + frm.elements['get_phone_2'].value + frm.elements['get_phone_3'].value;
   if (phone.length > 0 && phone.length<10) {

      alert('Please enter a valid phone');
      if (frm.elements['get_phone_1'].value.length<3 )
         frm.elements['get_phone_1'].focus(); 
      else{
         if (frm.elements['get_phone_2'].value.length<3 )
            frm.elements['get_phone_2'].focus(); 
         else
            frm.elements['get_phone_3'].focus(); 
      }

      return false;
      
   }
   if (phone.length == 0){
      alert('Please enter a Home Phone');
      frm.elements['get_phone_1'].focus(); 
      return false;
   }
   phone1 = frm.elements['get_phone2_1'].value + frm.elements['get_phone2_2'].value + frm.elements['get_phone2_3'].value;

   if (phone1.length > 0 && phone1.length<10) {

      alert('Please enter a valid phone');
	  
      if (frm.elements['get_phone2_1'].value.length<3 )
         frm.elements['get_phone2_1'].focus(); 
      else{
         if (frm.elements['get_phone2_2'].value.length<3 )
            frm.elements['get_phone2_2'].focus(); 
         else
            frm.elements['get_phone2_3'].focus(); 
      }

      return false;
      
   }
  
   phone2 = frm.elements['get_phone3_1'].value + frm.elements['get_phone3_2'].value + frm.elements['get_phone3_3'].value;

   if (phone2.length > 0 && phone2.length<10) {

      alert('Please enter a valid phone');
      if (frm.elements['get_phone3_1'].value.length<3 )
         frm.elements['get_phone3_1'].focus(); 
      else{
         if (frm.elements['get_phone3_2'].value.length<3 )
            frm.elements['get_phone3_2'].focus(); 
         else
            frm.elements['get_phone3_3'].focus(); 
      }

      return false;
      
   }
   return true;

}

function ValidReg1(frm)
{
	
   var prefix0 = 'get_';
   var input_array = new Array('first_name','phone_home','email');
   var error_array = new Array('First Name','Home Phone','Email Address');
	//alert("test");
   for (var i=0; i<input_array.length; i++) {
      var source = prefix0+input_array[i];          
      if (frm.elements[source].value.length == 0) {
         alert(error_array[i].substr(0,1).toUpperCase()+error_array[i].substr(1)+' can not be empty ');
		 
         frm.elements[source].focus();
         return false;
		 
	     }
		 
		/* if (input_array[i]=='phone_1' || input_array[i]=='phone_2' || input_array[i]=='phone_3')
		 {
			 ninp[] = input_array[i];
		 }
		 
		 if (ninp.length >= 3)
		 {
			 alert("test");
		 }
		 
*/		

		if (input_array[i]=='email' && echeck(frm.elements[source].value)==false)
		 {
			 	frm.elements[source].focus();
				return false;
		 }

   } 
   
   		phone = frm.elements['get_phone_home'].value;
   		if (phone.length > 0 && phone.length<10) {

    	 alert('Please enter a valid phone');
		 frm.elements['get_phone_home'].focus();
		 return false;
		}
    	return true;

}

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("Invalid E-mail ID")
		   return false
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		   alert("Invalid E-mail ID")
		   return false
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		    alert("Invalid E-mail ID")
		    return false
		}

		 if (str.indexOf(at,(lat+1))!=-1){
		    alert("Invalid E-mail ID")
		    return false
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		    alert("Invalid E-mail ID")
		    return false
		 }

		 if (str.indexOf(dot,(lat+2))==-1){
		    alert("Invalid E-mail ID")
		    return false
		 }
		
		 if (str.indexOf(" ")!=-1){
		    alert("Invalid E-mail ID")
		    return false
		 }

 		 return true					
}
