﻿function containsDOM (container, containee) {
var isParent = false;
do {
if ((isParent = container == containee))
  break;
containee = containee.parentNode;
}
while (containee != null);
return isParent;
}

function checkMouseEnter (element, evt) {
if (element.contains && evt.fromElement) {
return !element.contains(evt.fromElement);
}
else if (evt.relatedTarget) {
return !containsDOM(element, evt.relatedTarget);
}
}

function checkMouseLeave (element, evt) {
if (element.contains && evt.toElement) {
return !element.contains(evt.toElement);
}
else if (evt.relatedTarget) {
return !containsDOM(element, evt.relatedTarget);
}
}
function ltrim(str) { 
for(var k = 0; k < str.length && isWhitespace(str.charAt(k)); k++);
return str.substring(k, str.length);
}
function rtrim(str) {
for(var j=str.length-1; j>=0 && isWhitespace(str.charAt(j)) ; j--) ;
return str.substring(0,j+1);
}
function trim(str) {
return ltrim(rtrim(str));
}
function isWhitespace(charToCheck) {
var whitespaceChars = " \t\n\r\f";
return (whitespaceChars.indexOf(charToCheck) != -1);
}
function validEmail(email)
{
invalidChars = " /:,;'"
		
if (email == "") {
	return false
}
for (i=0; i<invalidChars.length; i++) {
	badChar = invalidChars.charAt(i)
	if (email.indexOf(badChar,0) > -1) {
		return false
	}
}
atPos = email.indexOf("@",1)
if (atPos == -1) {
	return false
}
if (email.indexOf("@",atPos+1) != -1) {
	return false
}
periodPos = email.indexOf(".",atPos)
if (periodPos == -1) {
	return false
}
if (periodPos+3 > email.length)	{
	return false
}

if (noHeb(email)== false) {
	return false
}
//	for (i=0; i<email.length; i++) {
//		if (email.charAt(i) >="à" && email.charAt(i)<="ú" )  {
//			return false
//		}
//	}
return true
}
function noHeb(str) 
{
invalidChars = "אבגדהוזחטיכלמנסעפצקרשתףךץם"
for (var i=0; i<invalidChars.length; i++)
{
	badChar = invalidChars.charAt(i)
	if (str.indexOf(badChar,0) > -1) {
		return false
	}
}
return true
}
function OpenWindow(site_url,the_width,the_height)
{
new_window=eval("window.open(site_url,'new_window', 'location=0, toolbar=0,status=0,menubar=0,resizable=1,location=0,scrollbars=1,left=100, top=10, width=" + the_width + ", height=" + the_height + "')");
new_window.focus();
}

var is_left;
var is_right;
var is_up;
var is_down;
var count_times;
var current_tab="1";
var on_tab="1";
var is_open=0;


function moveItRight() 
{
if (is_right==0)
    return;
var current_right;
current_right = parseInt(moving_div.style.left);
current_right = current_right +20;
moving_div.style.left=current_right;
count_times++;
if(current_right<0)
    setTimeout("moveItRight()",150);
}

function moveItDown(div_id) 
{
//alert(is_down);
if (is_down==0)
    return;
var current_down;
current_down = eval("parseInt(moving_div_" + div_id + ".style.top)");
// alert(current_down)
current_down = current_down + 20;
//alert(current_down)
eval("moving_div_" + div_id + ".style.top=" + current_down);
//current_down = eval("parseInt(moving_div_" + div_id + ".style.top)");
//alert(current_down);
count_times++;
//if(current_down<0)
    setTimeout("moveItDown(" + div_id + ")",150);
}

function moveItleft() 
{
if (is_left==0)
    return;
var current_left;
var div_width=moving_div.clientWidth;
// alert("div_width:" + div_width)
var to_stop_left = 400-div_width;
// alert("to_stop_left:" + to_stop_left)
current_left = parseInt(moving_div.style.left);
//alert("current_left:" + current_left)
current_left = current_left -20;
moving_div.style.left=current_left;
if (current_left >= to_stop_left)
setTimeout("moveItleft()",150);
// alert(moving_div.style.left);
} 

function moveItUp(div_id) 
{
if (is_up==0)
    return;
var current_up;
var div_height=eval("moving_div_" + div_id + ".clientHeight");
// alert("div_width:" + div_width)
var to_stop_up = 400-div_height;
// alert("to_stop_left:" + to_stop_left)
current_up = eval("parseInt(moving_div_" + div_id + ".style.top)");
//alert("current_left:" + current_left)
current_up = current_up - 20;
eval("moving_div_" + div_id + ".style.top=" + current_up);
if (current_up >= to_stop_up)
setTimeout("moveItUp(" + div_id + ")",150);
// alert(moving_div.style.left);
}  
function StopLeft() 
{
is_left=0;
moveItleft();
}


function StartLeft() 
{
is_left=1;
moveItleft();
}

function StopRight()
{
is_right=0;
moveItRight();
}


function StartRight() 
{
is_right=1;
moveItRight();
}

function StopUp(div_id)
{
is_up=0;
moveItUp(div_id);
}


function StartUp(div_id) 
{
is_up=1;
moveItUp(div_id);
}

function StopDown(div_id)
{
is_down=0;
moveItDown(div_id);
}


function StartDown(div_id) 
{
is_down=1;
//moveItDown(div_id);
alert("I am here")
oTxt.style.overflow="visible";
eval("moving_div_" + div_id + ".style.overflow=\"visible\"")
}

function OpenDiv(div_id)
{
//alert(div_id);
if (is_open==0)
{
    document.getElementById("icon_open_" + div_id).src="images/icon_arrow_up.gif"
    eval("moving_div_" + div_id + ".style.overflow=\"visible\"")
    is_open=1;
}    
else    
{
    document.getElementById("icon_open_" + div_id).src="images/icon_arrow_down.gif"
    eval("moving_div_" + div_id + ".style.overflow=\"hidden\"")
    is_open=0;
}
}

function ButtonOut(the_object)
{
the_object.className='td_plain_middle right_nav_off space_58 text_bold_no_height';
}

function ButtonOver(the_object)
{
the_object.className='td_plain_middle right_nav_on space_58 text_bold_no_height';
}

function DisplayDiv(div_id,the_object)
{
    var flag_value;
    flag_value = document.getElementById("flag_" + div_id).value;
    if (flag_value=="0")
    {
        eval("row_" + div_id + ".style.display='block'");
        eval("flag_" + div_id + ".value=1");
        the_object.onmouseover=""
        the_object.onmouseout=""
    }
    else
    {
       eval("row_" + div_id + ".style.display='none'");
       eval("flag_" + div_id + ".value=0");
       the_object.onmouseover=new Function('this.className="td_plain_middle right_nav_on space_58 text_bold_no_height"');
       the_object.onmouseout=new Function('this.className="td_plain_middle right_nav_off space_58 text_bold_no_height"');
    }
}
function DisplayDiv2(div_id,the_object)
{
var flag_value;
flag_value = document.getElementById("flag_" + div_id).value;
if (flag_value=="0")
{
    eval("row_" + div_id + ".style.display='block'");
    eval("flag_" + div_id + ".value=1");
    eval("href_" + div_id + ".className='On'");
    eval("div_" + div_id + ".className='Over'");
   // the_object.onmouseover=""
  //  the_object.onmouseout=""
}
else
{
   eval("row_" + div_id + ".style.display='none'");
   eval("flag_" + div_id + ".value=0");
   eval("href_" + div_id + ".className='Active'");
   eval("div_" + div_id + ".className='Reg'");
 //  the_object.onmouseover=new Function('this.className=""');
 //  the_object.onmouseout=new Function('this.className=""');
}  


}
function ShowRows()
{
document.getElementById('hidden_line').style.display='block';
}
function ShowSubCheck(div_id)
{
str1=eval("flag_hide_directory_" + div_id + ".value")
if(!parseInt(str1))
    {
    eval("document.all.the_link_" + div_id + ".className='nav_link_red_bold_underline'");
    eval("document.all.the_link_" + div_id + ".innerHTML='סגור'");
    eval("document.all.row_left_" + div_id + ".className='td_plain_middle space_157 space_164 table_ranked_border_right_left text'");
    eval("document.all.row_right_" + div_id + ".className='td_plain_middle space_159 space_164 table_ranked_border_right'");
    eval("document.all.parent_row_" + div_id + ".className='bg_parent_row'");
    eval("sub_directory_" + div_id + ".style.display='block'");
    eval("flag_hide_directory_" + div_id + ".value='1'")
    }
else
    {	
    eval("document.all.the_link_" + div_id + ".className='nav_link_blue_none'");
    eval("document.all.the_link_" + div_id + ".innerHTML='פרטים נוספים'");
    //eval("document.all.arrow_" + div_id + ".src='images/plus.gif'");
    eval("document.all.row_left_" + div_id + ".className='td_plain_middle space_157 space_164 table_ranked_border_right text'");
    eval("document.all.row_right_" + div_id + ".className='td_plain_middle space_159 space_164 table_ranked_border'");
    eval("document.all.parent_row_" + div_id + ".className=''");
    eval("sub_directory_" + div_id + ".style.display = 'none';");
    eval("flag_hide_directory_" + div_id + ".value='0'")
    }
}
function ShowTofes(div_id)
{

str1=eval("flag_hide_directory_2_" + div_id + ".value")
if(!parseInt(str1))
    {
    eval("tofes_opinion_" + div_id + ".style.display='block'");
    eval("flag_hide_directory_2_" + div_id + ".value='1'")
    }
else
    {
    eval("tofes_opinion_" + div_id + ".style.display = 'none';");
    eval("flag_hide_directory_2_" + div_id + ".value='0'")
    }
}

function ShowTofesRanked()
{

str1 = flag_directory_add_ranked.value
if(!parseInt(str1))
    {
    tofes_ranked.style.display='block';
    flag_directory_add_ranked.value='1';
    }
else
    {
    tofes_ranked.style.display='none';
    flag_directory_add_ranked.value='0';
    }
}

function WriteHtml(div_id)
{
    var flag_value;
    var the_text;
    flag_value = document.getElementById("flag_write_" + div_id).value;
    if (flag_value=="0")
    {
        document.getElementById("UpdateRanked_" + div_id).style.display="none";
        document.getElementById("UpdateRankedForm_" + div_id).style.display="block";
       // document.getElementById("update_url_" + div_id).innerHTML="עדכן פרטי מדורג";
        eval("flag_write_" + div_id + ".value=1");
        
    }
    else
    {
       document.getElementById("UpdateRanked_" + div_id).style.display="block";
       document.getElementById("UpdateRankedForm_" + div_id).style.display="none";
       //document.getElementById("update_url_on_" + div_id).innerHTML="חזור";
       eval("flag_write_" + div_id + ".value=0");
    }     
}

function EnlargePictureFinance(imagefile, title,id) 
{
	var testwin;	
	if (testwin==null)
		testwin = window.open('EnlargementFinance.asp?id=' + id + '&image=' + imagefile + '&title=' + title ,'new','location=0, toolbar=0,status=0,menubar=0,resizable=1');
	else
		testwin = window.location('EnlargementFinance.asp?id=' + id + '&image=' +imagefile + '&title=' + title ,'new','location=0, toolbar=0,status=0,menubar=0,resizable=1');
    testwin.moveTo(100,150) ;
    testwin.resizeTo(300,300);
	testwin.focus	
}

function ShowSubShowCheck(div_id)
{
    str1=eval("document.all.flag_hide_directory_" + div_id + ".value")
    if(!parseInt(str1))
        {
        eval("document.all.the_link_" + div_id + ".className='nav_link_red_bold_underline'");
        eval("document.all.the_link_" + div_id + ".innerHTML='סגור'");
        eval("document.all.row_left_" + div_id + ".className='td_plain_middle bg_cart space_223 text dir_rtl table_show_left_on'");
        eval("document.all.row_right_" + div_id + ".className='td_plain_middle_center bg_cart space_290 space_230 text table_show_right_on'");
        eval("document.all.parent_row_" + div_id + ".className='bg_table_ranked'");
        eval("document.all.sub_directory_" + div_id + ".style.display='block'");
        eval("document.all.flag_hide_directory_" + div_id + ".value='1'")
        }
    else
        {	
        eval("document.all.the_link_" + div_id + ".className='nav_link_blue_none_14'");
        eval("document.all.the_link_" + div_id + ".innerHTML='פרטים'");
        eval("document.all.row_left_" + div_id + ".className='td_plain_middle bg_cart space_223 text dir_rtl table_show_left'");
        eval("document.all.row_right_" + div_id + ".className='td_plain_middle_center bg_cart space_290 space_230 text table_show_right'");
        eval("document.all.parent_row_" + div_id + ".className=''");
        eval("document.all.sub_directory_" + div_id + ".style.display = 'none';");
        eval("document.all.flag_hide_directory_" + div_id + ".value='0'")
        }
}


function ShowSubShowShows(div_id)
{
    str1=document.getElementById("flag_hide_directory_" + div_id).innerHTML
    if(!parseInt(str1))
        {
      //  eval("document.all.the_link_" + div_id + ".className='nav_link_red_bold_underline'");
      //  eval("document.all.the_link_" + div_id + ".innerHTML='סגור'");
     //   eval("document.all.row_left_" + div_id + ".className='td_plain_middle bg_cart space_223 text dir_rtl table_show_left_on'");
     //   eval("document.all.row_right_" + div_id + ".className='td_plain_middle_center bg_cart space_290 space_230 text table_show_right_on'");
        document.getElementById("RowBox_" + div_id).className='RowOver';
        document.getElementById("OpenBox_" + div_id).style.display='block';
        document.getElementById("flag_hide_directory_" + div_id).innerHTML='1';
        }
    else
        {	
     //  eval("document.all.the_link_" + div_id + ".className='nav_link_blue_none_14'");
     //   eval("document.all.the_link_" + div_id + ".innerHTML='פרטים'");
     //   eval("document.all.row_left_" + div_id + ".className='td_plain_middle bg_cart space_223 text dir_rtl table_show_left'");
      //  eval("document.all.row_right_" + div_id + ".className='td_plain_middle_center bg_cart space_290 space_230 text table_show_right'");
     //   eval("document.all.parent_row_" + div_id + ".className=''");
        document.getElementById("RowBox_" + div_id).className='Row';
        document.getElementById("OpenBox_" + div_id).style.display = 'none';
        document.getElementById("flag_hide_directory_" + div_id ).innerHTML='0';
        }
}



function ShowDivContactVoluntarily(div_id)
{
   // alert(eval("document.form.GetContactDetails.flag_hide_directory_contact_" + div_id + ".value"))
    str1=eval("flag_hide_directory_contact_" + div_id + ".value")
    if(!parseInt(str1))
        {
        eval("contact_div_" + div_id + ".style.display='block'");
        eval("flag_hide_directory_contact_" + div_id + ".value='1'")
        }
    else
        {	
       
        eval("contact_div_" + div_id + ".style.display = 'none';");
        eval("flag_hide_directory_contact_" + div_id + ".value='0'")
        }   
}    

function ShowSubVoluntarilyCheck(div_id)
{
    str1= document.getElementById("flag_hide_directory_" + div_id).value
    if(!parseInt(str1))
        {
        document.getElementById("the_link_" + div_id).className='nav_link_red_bold_underline';
        document.getElementById("the_link_" + div_id).innerHTML='סגור';
        document.getElementById("row_left_" + div_id).className='td_plain_middle bg_cart space_279 text dir_rtl table_show_left_on';
        document.getElementById("row_right_" + div_id).className='td_plain_middle bg_cart space_281 space_230 text table_show_right_on';
        document.getElementById("parent_row_" + div_id).className='bg_table_ranked';
        document.getElementById("sub_directory_" + div_id).style.display='block';
        document.getElementById("flag_hide_directory_" + div_id).value='1';
        //eval("document.all.the_link_" + div_id + ".className='nav_link_red_bold_underline'");
        //eval("document.all.the_link_" + div_id + ".innerHTML='סגור'");
       // eval("document.all.row_left_" + div_id + ".className='td_plain_middle bg_cart space_279 text dir_rtl table_show_left_on'");
       // eval("document.all.row_right_" + div_id + ".className='td_plain_middle bg_cart space_281 space_230 text table_show_right_on'");
        //eval("document.all.parent_row_" + div_id + ".className='bg_table_ranked'");
      //  eval("sub_directory_" + div_id + ".style.display='block'");
      //  eval("flag_hide_directory_" + div_id + ".value='1'")
        }
    else
        {	
        document.getElementById("the_link_" + div_id).className='nav_link_blue_none_14';
        document.getElementById("the_link_" + div_id).innerHTML='פרטים';
        document.getElementById("row_left_" + div_id).className='td_plain_middle bg_cart space_279 text dir_rtl table_show_left';
        document.getElementById("row_right_" + div_id).className='td_plain_middle bg_cart space_281 space_230 text table_show_right';
        document.getElementById("parent_row_" + div_id).className='';
        document.getElementById("sub_directory_" + div_id).style.display='none';
        document.getElementById("flag_hide_directory_" + div_id).value='0';
      //  eval("document.all.the_link_" + div_id + ".className='nav_link_blue_none_14'");
       // eval("document.all.the_link_" + div_id + ".innerHTML='פרטים'");
      //  eval("document.all.row_left_" + div_id + ".className='td_plain_middle bg_cart space_279 text dir_rtl table_show_left'");
      //  eval("document.all.row_right_" + div_id + ".className='td_plain_middle bg_cart space_281 space_230 text table_show_right'");
      //  eval("document.all.parent_row_" + div_id + ".className=''");
      //  eval("sub_directory_" + div_id + ".style.display = 'none';");
      //  eval("flag_hide_directory_" + div_id + ".value='0'")
        }
}



function OpenWindow2(site_url,the_width,the_height)
{
	new_window=eval("window.open(site_url,'new_window', 'location=0, toolbar=0,status=0,menubar=0,resizable=0,location=0,scrollbars=1,left=100, top=70, width=" + the_width + "px, height=" + the_height + "px')");
	new_window.focus();
}


