﻿function select_picture(PictID,cardID){		
	var url = "get_picture.asp?PictID="+ PictID +"&cardID="+cardID;
	new Ajax.Updater("div_preview", url, {asynchronous:true});
}
function onclick_picture(picFile,picNumber){
   var sourceHTML=""
   if (document.getElementById('mainpic') && picFile!=''){
      if (document.all){
           document.getElementById('mainpic').style.filter="blendTrans(duration=1)";
           document.getElementById('mainpic').filters.blendTrans.Apply();
       }
       document.getElementById('mainpic').style.visibility='hidden';
	   document.getElementById('mainpic').src = picFile;
	   document.getElementById('mainpic').style.visibility='visible';		
       if (document.all){
           document.getElementById('mainpic').filters.blendTrans.Play();
       }
       if (picNumber!=''){
           if (document.getElementById("pictureTitle_"+picNumber)){
               sourceHTML=document.getElementById("pictureTitle_"+picNumber).value
           }    
           changeHTML('SlideImageComment',sourceHTML);
           changeHTML('SlideImageId',picNumber);
       }
   }
   return false;
}
function changeHTML(spanId,code){
    var element = document.getElementById(spanId);
	if(element) {
	    element.innerHTML = code;
	}
}


function maxinput(){
  len = document.form_contact.comments.value.length;
  maxlen = 150;
  if(len>maxlen)return false;
  else{document.form_contact.commentsLen.value = maxlen - parseInt(len)}
}

function DoCalAdmin(elTarget,elName) {
  if (showModalDialog) {
    var sRtn;
    sRtn = showModalDialog("calendar.asp",elTarget.value,"center=yes; dialogWidth=160pt; dialogHeight=170pt; status=0; help=0;");
    if (sRtn!=""){
       elTarget.value = sRtn;
    }
  } else
    alert("Internet Explorer 4.0 or later is required.")
 return false;
 window.document.focus;   
}

function check_contactForm(formObj) {		
	if (emptyField(formObj.name)) {window.alert("אנא מלא/י שם מלא ");formObj.name.focus();return false;}
	if (emptyField(formObj.phone)) {window.alert("אנא מלא/י טלפון");formObj.phone.focus();return false;}	
	if (emptyField(formObj.email)) {window.alert("אנא מלא/י שדה כתובת דואר אלקטרוני");formObj.email.focus();return false;}	
	if ( formObj.email.value!='' && !checkEmail(formObj.email.value)){alert("כתובת דואר אלקטרוני לא חוקית");formObj.email.select();return false;}	
}
