﻿//======================================================//
function AddLoadEvent(func) {
  var oldonload = window.onload;
  if (typeof window.onload != 'function') {
    window.onload = func;
  } else {
    window.onload = function() {
      if (oldonload) {
        oldonload();
      }
      func();
    }
  }
}

currentID = "<%= MENU_BAR %>"	
	    function OverBar(id)
	    {
		    if(id != currentID)
                
			    document.getElementById("tdBar" + id).style.backgroundImage = "url(images/NavBar_over_" + id + ".jpg)";
	    }
	    function OutBar(id)
	    {
		    if(id != currentID)
			    document.getElementById("tdBar" + id).style.backgroundImage = "url(images/NavBar_" + id + ".jpg)";
	    }
//======================================================//
function $(e){if(typeof e=='string')e=document.getElementById(e);return e};
function collect(a,f){var n=[];for(var i=0;i<a.length;i++){var v=f(a[i]);if(v!=null)n.push(v)}return n};
//======================================================//
ajax={};
ajax.x=function(){try{return new ActiveXObject('Msxml2.XMLHTTP')}catch(e){try{return new ActiveXObject('Microsoft.XMLHTTP')}catch(e){return new XMLHttpRequest()}}};
ajax.serialize=function(f){var g=function(n){return f.getElementsByTagName(n)};var nv=function(e){if(e.name)return encodeURIComponent(e.name)+'='+encodeURIComponent(e.value);else return ''};var i=collect(g('input'),function(i){if((i.type!='radio'&&i.type!='checkbox')||i.checked)return nv(i)});var s=collect(g('select'),nv);var t=collect(g('textarea'),nv);return i.concat(s).concat(t).join('&');};
ajax.send=function(u,f,m,a){var x=ajax.x();x.open(m,u,true);x.onreadystatechange=function(){if(x.readyState==4)f(x)};if(m=='POST')x.setRequestHeader('Content-type','application/x-www-form-urlencoded');x.send(a)};
ajax.get=function(url,func){ajax.send(url,func,'GET')};
ajax.gets=function(url){var x=ajax.x();x.open('GET',url,false);x.send(null);return x};
ajax.post=function(url,func,args){ajax.send(url,func,'POST',args)};
ajax.update=function(url,elm){var e=$(elm);var f=function(r){e.innerHTML=r};ajax.get(url,f)};
ajax.submit=function(url,fun,frm){ajax.post(url,fun,ajax.serialize(frm))};
//======================================================//
//======================================================//
function opacity(id, opacStart, opacEnd, millisec) {
    //speed for each frame
    var speed = Math.round(millisec / 100);
    var timer = 0;

    //determine the direction for the blending, if start and end are the same nothing happens
    if(opacStart > opacEnd) {
        for(i = opacStart; i >= opacEnd; i--) {
            setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
            timer++;
        }
    } else if(opacStart < opacEnd) {
        for(i = opacStart; i <= opacEnd; i++)
            {
            setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
            timer++;
        }
    }
}
//change the opacity for different browsers
function changeOpac(opacity, id) {
    var object = document.getElementById(id).style;
    object.opacity = (opacity / 100);
    object.MozOpacity = (opacity / 100);
    object.KhtmlOpacity = (opacity / 100);
    object.filter = "alpha(opacity=" + opacity + ")";
}

function ChangePic2( pic)
{
//alert(pic)
	opacity('BPic', 40, 100, 400)
	setTimeout("DoChange2('" + pic + "')", 20);
}

function DoChange2(pic)
{
	document.getElementById("BPic").src =  pic
}
function Details_Handler(id,pid) {

	trDetailsopen = document.getElementById("trDetailsopen" + id);
	tdDetailsopen = document.getElementById("tdDetailsopen" + id);
	//alert(trDetailsclose)
	if(trDetailsopen.style.display == "none")
	{					
		trDetailsopen.style.display = "";
		tdDetailsopen.innerHTML = "<iframe align='left' id='ifr" + id + "' name='ifr" + id + "' frameborder='no' scrolling='no' src='Resume.asp?id=" + id + "&PID=" + pid + "' width='484' height='145' ></iframe>";				
	}
	else
	{
	
		tdDetailsopen.innerHTML = "";	
		trDetailsopen.style.display = "none";
	}	
}


	//====================================================\\
	function Clear(num)
	{
			
		if(document.getElementById("FreeText").value == "הקלד/י טקסט חופשי לחיפוש" && num==1)
			document.getElementById("FreeText").value = ""

	}
	//====================================================\\
	function Fill(num)
	{
			
		if(document.getElementById("FreeText").value == "" && num==1)
			document.getElementById("FreeText").value = "הקלד/י טקסט חופשי לחיפוש"
			
	}

	function CheckLogin()
	{
		un = document.getElementById("mUsername");
		pw = document.getElementById("mPassword");
		
		if(un.value == "" || un.value == "כתובת אימייל"){alert("אנא מלא כתובת אימייל"); return false; un.focus();}
		if(pw.value == ""){alert("אנא מלא סיסמה"); return false; pw.focus();}
		
		return true;
	}
	
	function Win(URL, name, width, height)
	{
		var x = screen.width;
		var y = screen.height;
		x=(x/2)-(width/2);
		y=(y/2)-(height/2);
		var wini = window.open(URL, name, "top="+y+",left="+x+",toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,width="+width+",height="+height+",resizable=yes");
		wini.window.focus();
	}
	
    var bookmarkurl="http://www.adalah.org"
    var bookmarktitle="Adalah the Legal Center For Arab Minority Rights in Israel"

    function addbookmark(){
    if (document.all)
    window.external.AddFavorite(bookmarkurl,bookmarktitle)
    }
if(!window.JSFX)

JSFX=new Object();
JSFX.FadeImageRunning    = false;
JSFX.FadeImageMinOpacity = 70;
JSFX.FadeImageAutoUp   = 200;
JSFX.FadeImageAutoDown   = 200;
JSFX.FadeImageSavedOver  = null;
JSFX.FadeImageSavedOut   = null;
document.write('<STYLE TYPE="text/css">.imageFader{ position:relative; filter:alpha(opacity='+JSFX.FadeImageMinOpacity+'); -moz-opacity:'+JSFX.FadeImageMinOpacity/101+'}</STYLE>');
JSFX.fadeImage_actionOnMouseOver = function(e)
{
  srcElement=e ? e.target : event.srcElement;
  if(srcElement.className && srcElement.className=="imageFader")
    JSFX.fadeUp(srcElement);
  /*** If the document already had an onMouseOver handler, call it ***/
  if(JSFX.FadeImageSavedOver != null)
    JSFX.FadeImageSavedOver(e);
}
JSFX.fadeImage_actionOnMouseOut = function(e)
{
  srcElement=e ? e.target : event.srcElement;
  if(srcElement.className && srcElement.className=="imageFader")
    JSFX.fadeDown(srcElement);
  /*** If the document already had an onMouseOut handler, call it ***/
  if(JSFX.FadeImageSavedOut != null)
    JSFX.FadeImageSavedOut(e);
}

JSFX.fadeImageAuto = function(minOpacity, stepUp, stepDown)
{
  if(minOpacity)
    JSFX.FadeImageMinOpacity = minOpacity;
  if(stepUp)
    JSFX.FadeImageAutoUp  = stepUp;
  if(stepDown)
    JSFX.FadeImageAutoDown  = stepDown;

  /*** Save the original document mouseOver/Out events ***/
  JSFX.FadeImageSavedOver = document.onmouseover;
  JSFX.FadeImageSavedOut  = document.onmouseout;
  document.onmouseover  = JSFX.fadeImage_actionOnMouseOver ;
  document.onmouseout = JSFX.fadeImage_actionOnMouseOut ;
  JSFX.setMinOpacity(JSFX.FadeImageMinOpacity);
}
JSFX.setMinOpacity = function(minOpacity)
{
  if(document.layers) return;
  for(i=0 ; i<document.images.length ; i++)
  {
    var img = document.images[i];
    if(img.className=="imageFader")
    {
      if(img.filters)
        img.filters.alpha.opacity = JSFX.FadeImageMinOpacity;
      else
        img.style.MozOpacity = JSFX.FadeImageMinOpacity/101;
    }
  }
}

JSFX.fadeUpImg = function(imgName, step)
{
  if(document.layers || window.opera)
    return;
  img = document.images[imgName];
  if(img)
    JSFX.fadeUp(img, step);
}

JSFX.fadeUp = function(img, step)
{
  if(img)
  {
    if(!step) step=JSFX.FadeImageAutoUp;
    if(img.fade == null)
    {
      img.fade = new Object();
      img.fade.state   = "OFF";
      img.fade.upStep  = step;
      img.fade.downStep  = step;
      img.fade.minOpacity  = JSFX.FadeImageMinOpacity;
      img.fade.index = img.fade.minOpacity;
    }
    if(img.fade.state == "OFF")
    {
      img.fade.upStep  = step;
      img.fade.state = "FADE_UP";
      JSFX.startImageFading();
    }

    else if( img.fade.state == "FADE_UP_DOWN"
      || img.fade.state == "FADE_DOWN")
    {
      img.fade.upStep  = step;
      img.fade.state = "FADE_UP";
    }
  }
}

JSFX.fadeDownImg = function(imgName, step)
{

  if(document.layers || window.opera)
    return;
  img = document.images[imgName];
  if(img)
    JSFX.fadeDown(img, step);
}

JSFX.fadeDown = function(img, step)
{
  if(img)
  {
    if(!step) step=JSFX.FadeImageAutoDown;

    if(img.fade.state=="ON")
    {
      img.fade.downStep  = step;
      img.fade.state="FADE_DOWN";
      JSFX.startImageFading();
    }

    else if(img.fade.state == "FADE_UP")
    {
      img.fade.downStep  = step;
      img.fade.state="FADE_UP_DOWN";
    }
  }
}

JSFX.startImageFading = function()
{
  if(!JSFX.FadeImageRunning)
    JSFX.FadeImageAnimation();
}

JSFX.FadeImageAnimation = function()
{
  JSFX.FadeImageRunning = false;
  for(i=0 ; i<document.images.length ; i++)
  {
    var img = document.images[i];
    if(img.fade)
    {
      if(img.fade.state == "FADE_UP")
      {
        img.fade.index+=img.fade.upStep;
        if(img.fade.index > 100)
          img.fade.index = 100;

        if(img.filters)
          img.filters.alpha.opacity = img.fade.index;
        else
          img.style.MozOpacity = img.fade.index/101;
        if(img.fade.index == 100)
          img.fade.state="ON";
        else
          JSFX.FadeImageRunning = true;
      }
      else if(img.fade.state == "FADE_UP_DOWN")
      {
        img.fade.index+=img.fade.upStep;
        if(img.fade.index > 100)
        img.fade.index = 100;
        if(img.filters)
          img.filters.alpha.opacity = img.fade.index;
        else
          img.style.MozOpacity = img.fade.index/101;
        if(img.fade.index == 100)
          img.fade.state="FADE_DOWN";
        JSFX.FadeImageRunning = true;
      }
      else if(img.fade.state == "FADE_DOWN")
      {
        img.fade.index-=img.fade.downStep;
        if(img.fade.index < img.fade.minOpacity)
          img.fade.index = img.fade.minOpacity;
        if(img.filters)
          img.filters.alpha.opacity = img.fade.index;
        else
          img.style.MozOpacity = img.fade.index/101;
        if(img.fade.index == img.fade.minOpacity)
          img.fade.state="OFF";
        else
          JSFX.FadeImageRunning = true;
      }
    }
  }
  /*** Check to see if we need to animate any more frames. ***/
  if(JSFX.FadeImageRunning)

    setTimeout("JSFX.FadeImageAnimation()", 10);
}

//======================================================//
