﻿// (c) Ohad Ninio, Thales.co.il

// If you want to use one (or more) of the menuscripts - You are allowed to do so as long as you put a link in

// ALL the pages that use the script to http://www.thales.co.il/

// Also, please let us know by email that you are using the script to this email address : info@Thales.co.il

// so we can send you conformation to use the script



// main menu items

var menu_items = new Array



menu_items[0] = new create_menu_item("/index.php", "main_page", "/jpegs/main_page_off.jpg", -210, 171, 0, 171, -1);

menu_items[1]=new create_menu_item("","about","/jpegs/about_us.jpg",-210,206,0,206,-1);

menu_items[2] = new create_menu_item("", "movies", "/jpegs/movies.jpg", -210, 241, 0, 241, -1);

menu_items[3] = new create_menu_item("", "Thales_school", "/jpegs/limoodim_before_18.jpg", -210, 276, 0, 276, -1);

menu_items[4]=new create_menu_item("","after_school","/jpegs/after_tichon.jpg",-210,311,0,311,-1);

menu_items[5] = new create_menu_item("", "deals", "/jpegs/deals_off.jpg", -210, 346, 0, 346, -1);

menu_items[6]=new create_menu_item("/Riddle.html","riddle","/jpegs/riddle_off.jpg",-210,381,0,381,-1);

menu_items[7] = new create_menu_item("/forums", "forums", "/jpegs/forums.jpg", -210, 416, 0, 416, -1);

menu_items[8] = new create_menu_item("/ThalesInfoPage.php?ipn=34562", "contact_us", "/jpegs/contact_us_off.jpg", -210, 451, 0, 451, -1);

 menu_items[9] = new create_menu_item("/ThalesMenuPage.php?mn=35977624", "takanon", "/jpegs/takanon.jpg", -210, 486, 0, 486, -1);




// Sub menu items

var sub_menu_items = new Array

sub_menu_items["main_page"] = new Array;

sub_menu_items["about"] = new Array;

sub_menu_items["about"][0] = new create_sub_menu_item("/ThalesInfoPage.php?ipn=35634", "about", "0", "/jpegs/who_are_we.jpg", 210, 210);

sub_menu_items["about"][1] = new create_sub_menu_item("/ThalesInfoPage.php?ipn=342256", "about", "1", "/jpegs/staff_off.jpg", 210, 245);

sub_menu_items["about"][2] = new create_sub_menu_item("/ThalesInfoPage.php?ipn=79651", "about", "2", "/jpegs/shita_off.jpg", 210, 280);

sub_menu_items["about"][3] = new create_sub_menu_item("/ThalesInfoPage.php?ipn=998560", "about", "3", "/jpegs/from_newspapers.jpg", 210, 315);



sub_menu_items["movies"] = new Array;

sub_menu_items["movies"][0] = new create_sub_menu_item("http://www.thales.co.il/ThalesMenuPage.php?mn=17", "movies", "0", "/jpegs/math_movies.jpg", 210, 230);

//sub_menu_items["movies"][1] = new create_sub_menu_item("http://www.thales.co.il/ThalesMenuPage.php?mn=17", "movies", "1", "/jpegs/before_test.jpg", 210, 265);



sub_menu_items["Thales_school"] = new Array;

sub_menu_items["Thales_school"][0] = new create_sub_menu_item("/ThalesInfoPage.php?ipn=2345620", "Thales_school", "0", "/jpegs/yesodi.jpg", 210, 260);

sub_menu_items["Thales_school"][1] = new create_sub_menu_item("/ThalesInfoPage.php?ipn=52673", "Thales_school", "1", "/jpegs/hativa.jpg", 210, 295);

sub_menu_items["Thales_school"][2] = new create_sub_menu_item("/ThalesInfoPage.php?ipn=5637452", "Thales_school", "2", "/jpegs/tichon.jpg", 210, 330);



sub_menu_items["after_school"] = new Array;

sub_menu_items["after_school"][0] = new create_sub_menu_item("/ThalesInfoPage.php?ipn=345345", "after_school", "0", "/jpegs/externi.jpg", 210, 295);

sub_menu_items["after_school"][1] = new create_sub_menu_item("/ThalesInfoPage.php?ipn=5634699", "after_school", "1", "/jpegs/mechina.jpg", 210, 330);

sub_menu_items["after_school"][2] = new create_sub_menu_item("/ThalesInfoPage.php?ipn=779414", "after_school", "2", "/jpegs/students.jpg", 210, 365);



sub_menu_items["deals"] = new Array;

sub_menu_items["deals"][0] = new create_sub_menu_item("/ThalesInfoPage.php?ipn=194712", "deals", "0", "/jpegs/lessons_deal.jpg", 210, 330);

sub_menu_items["deals"][1] = new create_sub_menu_item("/ThalesInfoPage.php?ipn=2358306", "deals", "1", "/jpegs/tirgool_deal.jpg", 210, 365);

sub_menu_items["deals"][2] = new create_sub_menu_item("/ThalesInfoPage.php?ipn=12350932", "deals", "2", "/jpegs/prepare_bagrut.jpg", 210, 400);


sub_menu_items["riddle"] = new Array;


sub_menu_items["forums"] = new Array;

sub_menu_items["forums"][0] = new create_sub_menu_item("forums/", "forums", "0", "/jpegs/forums_all.jpg", 210, 365);

sub_menu_items["forums"][1] = new create_sub_menu_item("forums/viewforum.php?f=7", "forums", "1", "/jpegs/consult_forums.jpg", 210, 400);

sub_menu_items["forums"][2] = new create_sub_menu_item("forums/viewforum.php?f=3", "forums", "2", "/jpegs/subjects_forums.jpg", 210, 435);

sub_menu_items["forums"][3] = new create_sub_menu_item("forums/viewforum.php?f=12", "forums", "3", "/jpegs/students_forums.jpg", 210, 470);

sub_menu_items["contact_us"] = new Array;

sub_menu_items["contact_us"][0] = new create_sub_menu_item("/ThalesInfoPage.php?ipn=65748", "contact_us", "1", "/jpegs/beroor_pratim.jpg", 210, 290);

sub_menu_items["contact_us"][1] = new create_sub_menu_item("/ThalesInfoPage.php?ipn=456835", "contact_us", "2", "/jpegs/order_lesson.jpg", 210, 325);

sub_menu_items["contact_us"][2] = new create_sub_menu_item("/ThalesInfoPage.php?ipn=987132", "contact_us", "3", "/jpegs/hatzaot_shipor.jpg", 210, 360);

sub_menu_items["contact_us"][3] = new create_sub_menu_item("/ThalesInfoPage.php?ipn=234536", "contact_us", "4", "/jpegs/drooshim.jpg", 210, 395);

sub_menu_items["contact_us"][4] = new create_sub_menu_item("/ThalesInfoPage.php?ipn=2342560", "contact_us", "5", "/jpegs/Ad_at_Thales.jpg", 210, 430);

sub_menu_items["contact_us"][5] = new create_sub_menu_item("/TOLchatOnLineStatus.php", "contact_us", "6", "/jpegs/ChatOnline.jpg", 210, 465);


sub_menu_items["takanon"] = new Array;




// change image 

function highlight_menu(image_name, status)  

{

    // get the location off the current image to highlight

    locx = document.images[image_name].style.left;

    locy = document.images[image_name].style.top;

    // set the highlight border location to the same location as the current image

    document.images["highlight_menu_item_top"].style.left = locx;

    document.images["highlight_menu_item_top"].style.top = locy;

    document.images["highlight_menu_item_bottom"].style.left = locx;

    document.images["highlight_menu_item_bottom"].style.top = parseInt(locy)+33+"px";

    

    if (status == "on") { // hightlight

        // for IE

        //document.images["highlight_menu_item_top"].style.visibility = "visible";

        //document.images["highlight_menu_item_bottom"].style.visibility = "visible";

        document.images["highlight_menu_item_top"].style.filter = "alpha(opacity=100)";

        document.images["highlight_menu_item_bottom"].style.filter = "alpha(opacity=100)";

        // for firefox

        document.images["highlight_menu_item_top"].style.opacity = 1;

        document.images["highlight_menu_item_bottom"].style.opacity = 1;

        //document.title = "on";

        //alert("the locx is (on) " + locx);

        Show_sub_menu(image_name, 1);

        sub_menu_items[image_name].show = 1;

    }

    else { // remove hightlight

       // for IE

        //document.images["highlight_menu_item_top"].style.visibilty = "hidden";

        //document.images["highlight_menu_item_bottom"].style.visibilty = "hidden";

        document.images["highlight_menu_item_top"].style.filter = "alpha(opacity=0)";

        document.images["highlight_menu_item_bottom"].style.filter = "alpha(opacity=0)";

        // for firefox

        document.images["highlight_menu_item_top"].style.opacity = 0;

        document.images["highlight_menu_item_bottom"].style.opacity = 0;

         //document.title = "off";

        //alert("the locx is (off) " + locx);

        Show_sub_menu(image_name, 0);

        sub_menu_items[image_name].show = 0;

    }



}







//counter_t = 0;







// accepts :

// menu_name    : the name of the menu to show it's sub menu

// show_or_hide : 1==show, 0==hide

function Show_sub_menu(menu_name, show_or_hide) {

//    counter_t++;
    if (sub_menu_items[menu_name].length<1) return;


    // The following 2 if statement are desgined to prevent a race between 

    // showing and hiding the current sub menu

    if (show_or_hide == 1 && sub_menu_items[menu_name].show == 0)

        clearTimeout(sub_menu_items[menu_name].timeout);

    if (show_or_hide == 0 && sub_menu_items[menu_name].show == 1)

        clearTimeout(sub_menu_items[menu_name].timeout);



    SubMenuLength = sub_menu_items[menu_name].length;

//    alert("Number of items in " + menu_name + " sub menu is :" + SubMenuLength);



    if (show_or_hide==1)

        opacity = sub_menu_items[menu_name][0].opacity + 5;

    else 

        opacity = sub_menu_items[menu_name][0].opacity - 8;



    for (SubMenu_i = 0; SubMenu_i < SubMenuLength; SubMenu_i++) {

        if (opacity > 0) 

            document.images[sub_menu_items[menu_name][SubMenu_i].name].style.visibility = "visible";

        else

            document.images[sub_menu_items[menu_name][SubMenu_i].name].style.visibility = "hidden";

        // set opacity for IE

        document.images[sub_menu_items[menu_name][SubMenu_i].name].style.filter = "alpha(opacity=" + opacity;

        // set opacity for firefox

        document.images[sub_menu_items[menu_name][SubMenu_i].name].style.opacity = opacity / 100;

        sub_menu_items[menu_name][SubMenu_i].opacity = opacity;

        opacity -= 5;

    }



    //document.title = "opacity : " + opacity + " show_or_hide : " + show_or_hide + "counter_t : " + counter_t;

    if (opacity < 100 && show_or_hide == 1) {

        var activate_string = "Show_sub_menu(\"" + menu_name + "\",1)";

        //alert(activate_string);

        sub_menu_items[menu_name].timeout = setTimeout(activate_string, 80);

    }



    if (sub_menu_items[menu_name][0].opacity>0 && show_or_hide == 0) {

        var activate_string = "Show_sub_menu(\"" + menu_name + "\",0)";

        //alert(activate_string);

        sub_menu_items[menu_name].timeout = setTimeout(activate_string, 80);

    }

}



function highlight_sub_menu(name, serialnum, status) {

    // get the location off the current image to highlight

    locx = document.images[name + serialnum].style.left;

    locy = document.images[name + serialnum].style.top;

    // set the highlight border location to the same location as the current image

    document.images["highlight_sub_menu_item_top"].style.left = locx;

    document.images["highlight_sub_menu_item_top"].style.top = locy;

    document.images["highlight_sub_menu_item_bottom"].style.left = locx;

    document.images["highlight_sub_menu_item_bottom"].style.top = parseInt(locy) + 33 + "px";



    if (status == "on") { // hightlight

        // for IE

        document.images["highlight_sub_menu_item_top"].style.filter = "alpha(opacity=100)";

        document.images["highlight_sub_menu_item_bottom"].style.filter = "alpha(opacity=100)";

        // for firefox

        document.images["highlight_sub_menu_item_top"].style.opacity = 1;

        document.images["highlight_sub_menu_item_bottom"].style.opacity = 1;

        //document.title = "on";

        //alert("the locx is (on) " + locx);

        highlight_menu(name, status);

    }

    else { // remove hightlight

        // for IE

        document.images["highlight_sub_menu_item_top"].style.filter = "alpha(opacity=0)";

        document.images["highlight_sub_menu_item_bottom"].style.filter = "alpha(opacity=0)";

        // for firefox

        document.images["highlight_sub_menu_item_top"].style.opacity = 0;

        document.images["highlight_sub_menu_item_bottom"].style.opacity = 0;

        //document.title = "off";

        //alert("the locx is (off) " + locx);

        highlight_menu(name, status);



    }

/*

    if (status == 'on') {

        highlight_menu(name, status);

    }

    else {

        highlight_menu(name, status);

    }

*/

}



function create_sub_menu_item(link, name, serialnum, source_image, startx, starty) {

    var txt;

    // create a reference with the given parameters

    txt = '';

    txt += '<A HREF="' + link;

    //txt += '"ONMOUSEOVER="highlight_menu(\'' + name + serialnum + '\',\'on\'); return false;"'

    //txt += '"ONMOUSEOVER="highlight_sub_menu(\'' + name + "\',\"" + serialnum + '\",\'on\'); return false;"'

    txt += '"ONMOUSEOVER="highlight_sub_menu(\''+name+'\','+serialnum+',\'on\'); return false;"'

    txt += 'ONMOUSEOUT="highlight_sub_menu(\'' + name + '\',' + serialnum + ',\'off\'); return false;"'

    txt += '>';

    txt += '<IMG NAME="' + name+serialnum + '" ';

    txt += ' CLASS="sub_menu_item" SRC="' + source_image + '" BORDER=0></IMG>';

    txt += '</A>';

    //alert(txt)

    document.write(txt);

    //alert("why ?");



    this.menu = name;

    this.name = name+serialnum;

    this.locx = startx;

    this.locy = starty;

    this.opacity = 0;

    document.images[name + serialnum].style.left = startx;

    document.images[name + serialnum].style.top = starty;

    document.images[name + serialnum].style.filter = "alpha(opacity=0)";

    document.images[name + serialnum].style.opacity = 0;

    

    

    //alert('the lcoaction for start is :'+this.locx+this.locy);

    //alert("zzzzzz ---->"+name);



}





/* JUST FOR REFERENCE !

<A HREF="odot_staff.html" ONMOUSEOVER="imgswap('odot_staff', 'on'); return false;" ONMOUSEOUT="imgswap('odot_staff', 'off'); return false;"><IMG SRC="images/odot_staff_off.gif" NAME="odot_staff" ALIGN=BOTTOM WIDTH=171 HEIGHT=35 BORDER=0></A>

*/

function create_menu_item(link, name, source_image, startx, starty, endx, endy, steps) {

var txt;

// create a reference with the given parameters

txt = '';

if (link != "") {

    txt += '<A HREF="' + link+'"';

    txt += '>';

}

txt += '<IMG NAME="' + name + '" ';

txt += ' ONMOUSEOVER="highlight_menu(\'' + name + '\',\'on\'); "'

txt += ' ONMOUSEOUT="highlight_menu(\'' + name + '\',\'off\'); "'

txt += ' CLASS="menu_item" SRC="' + source_image + '" BORDER=0></IMG>';

if (link != "") {

    txt += '</A>';

}

//alert(txt)

document.write(txt);

this.name = name;

this.locx = startx;

this.locy = starty;







//alert('the lcoaction for start is :'+this.locx+this.locy);





// NOTE : 

// this line overrides the user request if he states that he want -1 steps

if (steps==-1) steps=50+Math.random()*50;



this.max_steps=steps;

this.cur_step=1;



this.a1x=(2*(endx-startx))/steps;

this.dx=(-2*(endx-startx))/(steps*steps-steps);

this.a1y=(2*(endy-starty))/steps;

this.dy=(-2*(endy-starty))/(steps*steps-steps);



}





function move_all_menu_items()

{

  var menu_items_length=menu_items.length;

  //alert(menu_items_length);

  var do_again=0; // set if any of the menu items is still to be moved to place. 

//alert(navigator.appName);



//  var opacity_max_level;

//  if (navigator.appName.indexOf( "Micrsoft" ) != -1)

//  opacity_max_level=100;

//  else opacity_max_level=1;



  for (menu_i=0;menu_i<menu_items_length;menu_i++) {

    if (menu_items[menu_i].cur_step<=menu_items[menu_i].max_steps) {

	var stepx= menu_items[menu_i].a1x+(menu_items[menu_i]. cur_step-1)* menu_items[menu_i].dx;

	var new_locx= menu_items[menu_i].locx+stepx;

	menu_items[menu_i].locx=new_locx;



	var stepy= menu_items[menu_i].a1y+(menu_items[menu_i]. cur_step-1)* menu_items[menu_i].dy;

	var new_locy= menu_items[menu_i].locy+stepy;

	menu_items[menu_i].locy=new_locy;



	menu_items[menu_i].cur_step++;

	do_again=1;

		

	document.images[menu_items[menu_i].name].style.left=new_locx;	 		

	document.images[menu_items[menu_i].name].style.top =new_locy;

	// for IE

	document. images[menu_items[menu_i].name].style.filter="alpha(opacity="+100*menu_items[menu_i].cur_step / menu_items[menu_i].max_steps ;

	// for firefox

	document.images[menu_items[menu_i].name].style.opacity =menu_items[menu_i].cur_step / menu_items[menu_i].max_steps ;





    }

    else {

	//alert(menu_i+'...'+menu_items[menu_i].locx);

    }	

  }

  if (do_again) {

	setTimeout("move_all_menu_items()",20);

  }

}



function init_menu() 

{

//alert('Before init menu item');

//alert('after init menu item');

    //alert(menu_items[1]);

    // set the 2 images of top and bottom when highlighting a menu item

    var txt = '<IMG NAME="highlight_menu_item_top" CLASS="highlight_menu_item" SRC="/jpegs/highlight_top.gif" BORDER=0></IMG>';

    document.write(txt);

    txt = '<IMG NAME="highlight_menu_item_bottom" CLASS="highlight_menu_item" SRC="/jpegs/highlight_bottom.gif" BORDER=0></IMG>';

    document.write(txt);

    var txt = '<IMG NAME="highlight_sub_menu_item_top" CLASS="highlight_menu_item" SRC="/jpegs/highlight_top.gif" BORDER=0></IMG>';

    document.write(txt);

    txt = '<IMG NAME="highlight_sub_menu_item_bottom" CLASS="highlight_menu_item" SRC="/jpegs/highlight_bottom.gif" BORDER=0></IMG>';

    document.write(txt);

    document.images["highlight_menu_item_top"].style.opacity = 0;

    document.images["highlight_menu_item_bottom"].style.opacity = 0;



    move_all_menu_items();

}

var HeaderTextSize;
function setHeaderSize() {
//	window.alert("setHeaderSize");
	HeaderTextSize=72;
	decreaseHeaderFont();
}

function decreaseHeaderFont() {
//  window.alert("decreaseHeaderFont");
  document.getElementById("TitleText").style.fontSize=HeaderTextSize;

  var textheight = document.getElementById("TitleText").offsetHeight;
  if (textheight >86) { // 86 is the heighe of the containing cell
	HeaderTextSize=HeaderTextSize-6;
	
	decreaseHeaderFont();
	}
}







/**********************************************************************/

/* header part - start */

//<!-- This script and many more are available free online at -->

//<!-- The JavaScript Source!! http://javascript.internet.com -->



//<!-- Begin

slider_location_x = 0;

// Note - adjust slider_location_y to : 
// the last menu item + 35 (height of a single jpg menu)
slider_location_y = 521;



//slider's width

//var swidth=171

//var swidth_ns = swidth - 10

var swidth = 210;

var swidth_ns = 200;



//slider's height

var sheight = 100;



//slider's speed

var sspeed = 2;



//messages: change to your own; use as many as you'd like; set up Hyperlinks to URLs as you normally do: <a target=... href="... URL ...">..message..</a>

var singletext = new Array()

singletext[0] = '<div align="center" dir="RTL"><FONT FACE="Tahoma, sans-serif" COLOR="#000000" size=4 ><SPAN LANG="utf-8"><B>ברוכים הבאים !</B></SPAN></FONT></div>';



singletext[1]='<div align="center" dir="RTL"><FONT FACE="Tahoma, sans-serif" COLOR="#ff0000" size=4 ><SPAN LANG="he-IL"><B>הזוכה בחידה הקודמת הוא שחר ל. מבית הספר עירוני בבאר-שבע.</B></SPAN></FONT></div>';


singletext[2]='<div align="center"><font face=Arial size=4 color="black"><b><a href="Riddle.html"> החידה החדשה </a></b></div></FONT>'


singletext[3] = '<div align="center"><img src="/jpegs/logo_background_with_eyes_with_mitzmootz.gif" border="0"></div>';







if (singletext.length>1)

i=1

else

i=0

function start(){

if (document.all){

ieslider1.style.top=sheight

iemarquee(ieslider1)

}

else if (document.layers){

document.ns4slider.document.ns4slider1.top=sheight

document.ns4slider.document.ns4slider1.visibility='show'

ns4marquee(document.ns4slider.document.ns4slider1)

}

else if (document.getElementById&&!document.all){

document.getElementById('ns6slider1').style.top=sheight

ns6marquee(document.getElementById('ns6slider1'))

}

}

function iemarquee(whichdiv){

iediv=eval(whichdiv)

if (iediv.style.pixelTop>0&&iediv.style.pixelTop<=sspeed){

iediv.style.pixelTop=0

setTimeout("iemarquee(iediv)",100)

}

if (iediv.style.pixelTop>=sheight*-1){

iediv.style.pixelTop-=sspeed

setTimeout("iemarquee(iediv)",100)

}

else{

iediv.style.pixelTop=sheight

iediv.innerHTML=singletext[i]

if (i==singletext.length-1)

i=0

else

i++

}

}

function ns4marquee(whichlayer){

ns4layer=eval(whichlayer)

if (ns4layer.top>0&&ns4layer.top<=sspeed){

ns4layer.top=0

setTimeout("ns4marquee(ns4layer)",100)

}

if (ns4layer.top>=sheight*-1){

ns4layer.top-=sspeed

setTimeout("ns4marquee(ns4layer)",100)

}

else{

ns4layer.top=sheight

ns4layer.document.write(singletext[i])

ns4layer.document.close()

if (i==singletext.length-1)

i=0

else

i++

}

}

function ns6marquee(whichdiv){

ns6div=eval(whichdiv)

if (parseInt(ns6div.style.top)>0&&parseInt(ns6div.style.top)<=sspeed){

ns6div.style.top=0

setTimeout("ns6marquee(ns6div)",100)

}

if (parseInt(ns6div.style.top)>=sheight*-1){

ns6div.style.top=parseInt(ns6div.style.top)-sspeed

setTimeout("ns6marquee(ns6div)",100)

}

else{

ns6div.style.top=sheight

ns6div.innerHTML=singletext[i]

if (i==singletext.length-1)

i=0

else

i++

}

}

//  End -->

/* header part - end */

/**********************************************************************/

/**********************************************************************/

/* body part - start */

if (document.layers)

document.write(singletext[0])



if (document.all){

document.writeln('<div style="position:absolute;left:'+slider_location_x+';top:'+slider_location_y+';overflow:hidden;width:'+swidth+';height:'+sheight+';clip:rect(0 '+swidth+' '+sheight+' 0);border:5 outset deeppink;" onmouseover="sspeed=0;" onmouseout="sspeed=2">')

document.writeln('<div id="ieslider1" style="position:absolute;left:'+slider_location_x+':top:'+slider_location_y+';width:'+swidth+';">')

document.write(singletext[0])

document.writeln('</div></div>')

}



/* NOTE TO ME : 

   when you change the size, pay attention to the size of the cliprect because 

   this is where it draws ... */

if(document.getElementById&&!document.all){

    document.writeln('<div style=" position:absolute;left:' + slider_location_x + ';top:' + slider_location_y + ';overflow:hidden;width' + swidth_ns + ';height:' + sheight + ';clip:rect(0 220 110 0);border:5px outset deeppink;" onmouseover="sspeed=0;" onmouseout="sspeed=2">')

    document.writeln('<div id="ns6slider1" style="position:relative;width:' + swidth_ns + ';">')

document.write(singletext[0])

document.writeln('</div></div>')

}

















/* body part - end */

/**********************************************************************/



window.onload = new init_menu(); // floating menus script 

window.onload = new start(); // side marquee

// window.onload = new setHeaderSize(); // sets the header size according to window size

// window.onresize = new setHeaderSize(); // resizes the TitleHeaderAccording to new window size






