function checkmember(pleaseFill) {
	var err=""
	if (($("#Pname").val() == "") || ($("#last_name").val() == "") || ($("#tel").val() == "") || ($("#email").val() == ""))
	{
		alert(pleaseFill);
	}
	else{
		$("#contactForm").submit();
	}
}

function checkmemberfamily(pleasefill,name,lname,address,email,phone,or)
{
	
	var err=pleasefill+":\n";
	if (document.all.Fname.value == "")
	{
		err=err+name+"\n";
	}
	
	if (document.all.Lname.value == "")
	{
		err=err+lname+"\n";
	}	
	
	if (document.all.address.value == "" && document.all.email.value == "" && document.all.phone.value == "")
	{
		err=err+address+" "+or+" "+phone+" E-mail";
	}else{
		if (document.all.email.value!="")
		{
			if ((document.all.email.value.indexOf("@")==-1)||(document.all.email.value.indexOf(".")==-1))
			{
				err=err+email+"\n"
			}
		}
	}
	
	if (err!=pleasefill+":\n")
	{
		alert(err);
		return false;
	}else{
		return true
	}
}

function add_family()
{
	if(1!=1){
		alert ("        ");
	}else{
		open_win('modules/add_family.asp',275,200);
	}
}

function open_win(str,str2,str3)  //This function opens the window or focus on the window
{
	windowHandle=window.open( ""+str+"" , "Print" , "toolbar=no,status=no,scrollbars=no,dependent,resizable=yes,width="+str2+",height="+str3+",left=400,top=400" )
}

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_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}

function getcity(qstring,where,target){
	qstring=qstring.replace(/ /g,"[sp]");
	var xmlhttp2 = new ActiveXObject("Microsoft.XMLHTTP");
	xmlhttp2.Open("POST","modules/city.asp?rand="+ Math.random() ,false);
	xmlhttp2.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
	xmlhttp2.send("qstring=" + qstring + "&target=" + target + "&where=" + where);
	document.getElementById(where).innerHTML=xmlhttp2.responseText;	
}

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_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_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 test(){
	jBox.open('jBoxID','inline','inline text','title','boxAttr');
}

////----- text for image in the gallery -----////
function showText(picID) {
	
	$.get("modules/picText.asp?id="+picID+"&rnd=" + Math.random(), function(data){
	
	var fc = $("#flashContaner").offset();
	//alert(fc.top);
	leftPos = (picID == 2)?fc.left+415:fc.left+360;
	//topPos = fc.top+175

//	$("#picTextDiv").html("<div>" + data + "</div>").openjBox("model=false,width=450,height=300,left=" + leftPos + ",top=" + topPos)
	$("#picTextDiv").html("<div class='text_div' style='left:" + leftPos + ";'>" + data + "</div>");
	has_scrollbar("contant");
});
}

function hideText() {
	//$("#picTextDiv").hidejBox();
	$("#picTextDiv").html("");
}

function has_scrollbar(elem_id){ 
	elem = document.getElementById(elem_id); 
	if (elem.clientHeight > elem.scrollHeight) $("#scrollDiv").hide();
		//alert("The element doesn't have a vertical scrollbar."); 
} 

////////-------------- scroll buttons -------------/////////

//function scrollDivDown(id){
//	document.getElementById(id).scrollTop+=1;
//	timerDown=setTimeout("scrollDivDown('" + id + "');",10);
//}
//	
//function scrollDivUp(id){
//	document.getElementById(id).scrollTop-=1;
//	timerUp=setTimeout("scrollDivUp('" + id + "');",10);
//}
//
//function stopscroll(id){
//	document.getElementById(id).scrollTop=document.getElementById(id).scrollTop;
//	timerDown=0//setTimeout("scrollDivDown('" + id + "');",0);
//	timerUp=0//setTimeout("scrollDivUp('" + id + "');",0);
//}
	var timerDown,timerUp;
	function scrollDivDown(obj){
		$("." +obj).scrollTo("+=2");
		timerDown=setTimeout("scrollDivDown('"+ obj + "');",20);
	}
	
	function scrollDivUp(obj){
		$("." +obj).scrollTo("-=2");
		timerUp=setTimeout("scrollDivUp('"+ obj + "');",20);
	}
	
////////--------- Auto complete --------------///////////

var xmlHttp
function showHint2(input_txt,output_rslt,str,primaryKey){
if(str.length<1){
	return;
}
  $.ajax({
    type: "POST",
    url: "/gethint.asp?sid=" + Math.random(),
    data: "q="+ str,
    success: function(html){
		$("#" + output_rslt).show();
		arr=html.split("^");
		$("#" + output_rslt).empty();
		for(i=0;i<arr.length-1;i++){
			var compName = arr[i].split("~")[0];
	 		var id=arr[i].split("~")[1];
        	$("#"+output_rslt).append("<span style='cursor:pointer' onclick=\"$('#" + input_txt + "').val($(this).text());$('#" + primaryKey + "').val("+ id +");$('#" + output_rslt + "').hide();\" onMouseOver=\"this.style.background='#dddddd'\" onMouseOut=\"this.style.background='#f9f9f8'\">" + compName + "</span><br/>");
		
		///	funStr = "<span style='cursor:pointer' onclick=\"comp=$(this).text().split('~');$('#" + input_txt + "').val(comp[0]);$('#" + output_rslt + "').hide();\" onMouseOver=\"this.style.background='#dddddd'\" onMouseOut=\"this.style.background='#ffffff'\">"
  		///	p=arr[i].split("~")
		///	funStr = funStr + p[0] + "</span><br/>"
		///	$("#"+output_rslt).append(funStr);
			
      	//	$("#"+output_rslt).append("<span style='cursor:pointer' onclick=\"$('#" + input_txt + "').val($(this).text());$('#" + output_rslt + "').hide();\" onMouseOver=\"this.style.background='#dddddd'\" onMouseOut=\"this.style.background='#ffffff'\">" + arr[i] + "</span><br/>");
      	}
    } 
  })
}

function showHint(str) {
	if (str.length==0){ 
	  document.getElementById("txtHint").innerHTML="";
	  return;
	}
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null){
	  alert ("Your browser does not support AJAX!");
	  return;
	} 
	var url="gethint.asp";
	url=url+"?q="+encodeURI(str);
	url=url+"&sid="+Math.random();
	xmlHttp.onreadystatechange=stateChanged;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
} 

function stateChanged() { 
	//When the state changes to 4 ("complete"), the content of the txtHint placeholder is filled with the response text.
	if (xmlHttp.readyState==4){ 
		document.getElementById("txtHint").innerHTML=xmlHttp.responseText;
	}
}

function GetXmlHttpObject() {
	var xmlHttp=null;
	try {
		// Firefox, Opera 8.0+, Safari
		xmlHttp=new XMLHttpRequest();
	}
	catch (e) {
	  // Internet Explorer
	  try {
		xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
	  }
	  catch (e) {
		xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
	  }
	}
	return xmlHttp;
}

function fillField(str) {
	//alert(str);
	document.getElementById("txt1").value=str;
}

function linkToPage(lnk) {
	switch(lnk){
	case 1: 
		document.location.href('index.asp')
		break;
	case 2: 
		document.location.href('ramiDavid.asp?page=???????&id=2')
		break;
	case 3: 
		document.location.href('ramiDavid.asp?page=??????%20??????&id=62')
		break;
	case 4: 
		document.location.href('contact.asp')
		break;
	default:document.location.href('index.asp')
	}	
}

openWin = function(url,name,width,height,xpos,ypos,chrome,scroll){
  var x, y, w, h, moveX=0, moveY=0, features="";
  chrome = chrome ? "yes" : "no";
  scroll = scroll ? "yes" : "no";
  features += "toolbar="+chrome+",location="+chrome+",status="+chrome+",menubar="+chrome;
  features += ",scrollbars="+scroll+",resizable="+scroll;
  if(width) features += ",width="+width;
  if(height) features += ",height="+height;
  if(xpos && window.screen){
    w = window.screen.availWidth;
    width = parseInt(width);
    switch(xpos){
      case "left": x = 0; break;
      case "center": x = (w-width)/2; break;
      case "right": x = w-width; break;
      default: x = xpos;
    }
    features += ",screenX="+x+",left="+x;
    var moveX = x;
  }
  if(ypos && window.screen){
    h = window.screen.availHeight;
    height = parseInt(height);
    switch(ypos){
      case "top": y = 0; break;
      case "middle": y = (h-height)/2; break;
      case "bottom": y = h-height; break;
      default: y = ypos;
    }
    features += ",screenY="+y+",top="+y;
    var moveY = y;
  }
  openWinReference = window.open(url,name,features);
  if(moveX || moveY){
    // position the window for browsers that don't recognize screenX, screenY
    openWinReference.moveTo(moveX,moveY);
  }
}
openScroll = function(url,name,width,height){
  openWin(url,name,width,height,false,false,false,"scroll");
}
openCenter = function(url,name,width,height){
  openWin(url,name,width,height,"center","middle");
}
openCenterScroll = function(url,name,width,height){
  openWin(url,name,width,height,"center","middle",false,"scroll");
}
openFull = function(url,name){
  openWin(url,name,false,false,false,false,"chrome","scroll");
}


$(function(){
		   $("#fixed").css('width',$("#allSiteTBL").width());
		   $("#fixed").css({left: (($(window).width()/2)-($("#fixed").width()/2))})
	//$("#fixed").width($("#allSiteTBL").width());	 
});

//--------- scroll --------------//
var timerDown,timerUp;
function scrollDivDown(obj){
	$("#" +obj).scrollTo("+=3");
	timerDown=setTimeout("scrollDivDown('"+ obj + "');",20);
}

function scrollDivUp(obj){
	$("#" +obj).scrollTo("-=3");
	timerUp=setTimeout("scrollDivUp('"+ obj + "');",20);
}

//----------- print ------------//
function prntImg(src) {
		window.open(src,"prntWindow");
		prntWindow.print();
}

//-------------- send form --------------//
/*
$(document).ready(function() {
  $("#signup").click(function() {
     resetFields();
    var emptyfields = $("input[value=]");
    if (emptyfields.size() > 0) {
      emptyfields.each(function() {
        $(this).stop()
        .addClass("required");
      });
    }
  });
});
 function resetFields() {
  $("input[type=text], input[type=password]").removeClass("required");
}
*/

