﻿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_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_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 PopupPic(sPicURL,sPicName) { 
	var wd = 550;
	var ht = 350;
	var d = ((screen.width-wd)/2);
	var h = ((screen.height-ht)/2);
    window.open('popup-pic.asp?URL='+sPicURL+'&name='+sPicName,'popupImage','top='+h+',left='+d+',width='+wd+',height='+ht+',toolbar=no,location=no,directories=no,menubar=no,status=yes,scrollbars=auto,resizable=yes');
}

function PopupPict(sPicURL,wd,ht) { 
	var d = ((screen.width-wd)/2);
	var h = ((screen.height-ht)/2);
    window.open('popup-pic.html?pic='+sPicURL,'popupImage','top='+h+',left='+d+',width='+wd+',height='+ht+',toolbar=no,location=no,directories=no,menubar=no,status=yes,scrollbars=auto,resizable=yes');
}

function popupPrivacy() {
	wd = 800;
	ht = 600;
	d = (screen.width-wd)/2;
	h = ((screen.height-ht)/2);
	window.open('Terms.asp','privacy','top='+h+',left='+d+',width='+wd+',height='+ht+',toolbar=yes,location=yes,directories=yes,status=yes,menubar=yes,scrollbars=yes,resizable=yes').focus();
}

function PopupGuide() {
	wd = 548;
	ht = 250;
	d = (screen.width-wd)/2;
	h = ((screen.height-ht)/2);
	window.open('Guide.html','guide','top='+h+',left='+d+',width='+wd+',height='+ht+',toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes').focus();
}

function PopupPrint(sUrl) {
	wd = 750;
	ht = 550;
	d = (screen.width-wd)/2;
	h = ((screen.height-ht)/2);
	window.open(sUrl,'printv','top='+h+',left='+d+',width='+wd+',height='+ht+',toolbar=no,location=no,directories=no,status=yes,menubar=yes,scrollbars=yes,resizable=yes').focus();
}

function doSearch() {
	var sForm = window.document.searchForm;
	if(sForm.sq.value.length < 2) {
		alert('יש להכניס ביטוי לחיפוש');
	} else {
		sForm.submit();
	}
}

function doSearchPage() {
	var pForm = window.document.searchFormPage;
	if(pForm.sq.value.length < 2) {
		alert('יש להכניס ביטוי לחיפוש');
		return false;
	} else {
		return true;
	}
}

// =========== Functions for <div> ==========

function pLayer(layerName) {
	if (document.getElementById(layerName).style.display == "none") {
		document.getElementById(layerName).style.display = "block";
	}
	else {
		document.getElementById(layerName).style.display = "none";
	} 
}

function ColapseAll(StrDivName) {
	var d = document.getElementsByTagName('div');
	for (var h=0;h<d.length;h++)
	{
		if (d[h].id.substr(0, 3) == StrDivName)
			d[h].style.display = 'none';
	}
}

function ExpandAll(StrDivName) {
	var d = document.getElementsByTagName('div');
	for (var h=0;h<d.length;h++)
	{
		if (d[h].id.substr(0, 3) == StrDivName)
			d[h].style.display = 'block';
	}
}

function closeDiv() {
	var cDiv = document.getElementById('WelcomDiv');
	cDiv.style.display = 'none';
}

var win;
function openCenterWindow(url,wd,ht,st) {
	d = (screen.width-wd)/2;
	h = ((screen.height-ht)/2);
	win = window.open(url,'','top='+h+',left='+d+',width='+wd+',height='+ht+',toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars='+st+',resizable='+st+'');
	if(!win) {
		document.location.href = url;
	}
}

function popupTalkBack(iID) {
	//window.open('popup-board.asp','board','width=400,height=350,left=10,top=10,scrollbars=1');
	openCenterWindow('popup-talkback.asp?id='+iID,400,350,0);
}

function popupAll(iID) {
	//window.open('popup-board.asp','board','width=400,height=350,left=10,top=10,scrollbars=1');
	openCenterWindow('popup-all-talkback.asp?id='+iID,500,400,1);
}


function fnHideImages() {
	var aImg = document.getElementsByTagName('img');
	for(i=0;i<aImg.length;i++) {
		aImg.item(i).style.display = 'none';
	}
	document.getElementById('aHideImages').href = 'javascript:fnShowImages();';
	document.getElementById('aHideImages').innerHTML = 'הצג תמונות';
}

function fnShowImages() {
	var aImg = document.getElementsByTagName('img');
	for(i=0;i<aImg.length;i++) {
		aImg.item(i).style.display = 'block';
	}
	document.getElementById('aHideImages').href = 'javascript:fnHideImages();';
	document.getElementById('aHideImages').innerHTML = 'הסתר תמונות';
}
