//Showing and Hiding the sub menu
var ent;
last_div='bar';

function relocate_div(new_one) {
		if (new_one != 'bar') {
			themenuoffsetX = document.body.clientWidth/2 +139
			document.getElementById(new_one).style.left = themenuoffsetX;		
		}
}

function chng_div(new_one)
{
		hideLast();
		document.getElementById(new_one).style.visibility = "visible";		
		last_div=new_one
}

function hideLast()
{
	document.getElementById(last_div).style.visibility = "hidden";
}



//Changing the backgroung color of main bar 
var last_obj = null;
function show_in_focus (in_focus_obj,basic_color,new_color)
{
 if (document.all[in_focus_obj])
	 {
				if (last_obj != null)
				last_obj.style.background=basic_color
				in_focus_obj.style.background =new_color
				last_obj= in_focus_obj;
		}
	}	
	

//Changing the text color of main bar 	
var last_obj = null;
function chng_color (new_obj)
	 {
				if (last_obj != null)
				last_obj.style.color='#FFFFFF'
				new_obj.style.color ='#330066'
				last_obj= new_obj;
	}	

//Changing the text color of main bar again	
var last_obj = null;
function chng_color_again (new_obj)
	 {
				if (last_obj != null)
				last_obj.style.color='#330066'
				new_obj.style.color ='#000000'
				last_obj= new_obj;
	}	
		

//The default sub menu (transparent)
document.write (' <div id="bar" style="position:absolute;visibility:hidden;top:1;left:1;z-index:1" onmouseover=show_in_focus(ent,"#330066","#CECECE") onmouseout=show_in_focus(ent,"#CECECE","#DFDFDF")>')
document.write ('&nbsp;')
document.write ('</div>')



//The Rolling Barnds
function checkBrowser(){
	this.ver=navigator.appVersion
	this.dom=document.getElementById?1:0
	this.ie5=(this.ver.indexOf("MSIE 5")>-1 && this.dom)?1:0;
	this.ie4=(document.all && !this.dom)?1:0;
	this.ns5=(this.dom && parseInt(this.ver) >= 5) ?1:0;
	this.ns4=(document.layers && !this.dom)?1:0;
	this.cbw=(this.ie5 || this.ie4 || this.ns4 || this.ns5)
	return this
}
cbw=new checkBrowser()

timSpeed=40//The speed of the timeout between each scroll.
contHeight=40//The height of the container (change this when it scrolls to much or to little)

function makeScrollObj(obj,nest)
{
	nest=(!nest) ? '':'document.'+nest+'.'										
	this.el=cbw.dom?document.getElementById(obj):cbw.ie4?document.all[obj]:cbw.ns4?eval(nest+'document.'+obj):0;
 this.css=cbw.dom?document.getElementById(obj).style:cbw.ie4?document.all[obj].style:cbw.ns4?eval(nest+'document.'+obj):0;		
	this.height=cbw.ns4?this.css.document.height:this.el.offsetHeight
	this.top=b_gettop										
	return this
}

function b_gettop()
{
	var gleft=(cbw.ns4 || cbw.ns5) ? eval(this.css.top):eval(this.css.pixelTop);
	return gleft;
}

var scrollTim;
var active=0;

function scroll(speed)
{
	clearTimeout(scrollTim)
	way=speed>0?1:0
	if((!way && oScroll[active].top()>-oScroll[active].height+contHeight) || (oScroll[active].top()<0 && way)){
		oScroll[active].css.top=oScroll[active].top()+speed
		scrollTim=setTimeout("scroll("+speed+")",timSpeed)
	}
}

function noScroll()
{
	clearTimeout(scrollTim)
}

function scrollArray()
{
	oScroll=new Array()
	oScroll[0]=new	makeScrollObj('div1','divShow')
	oScroll[0].css.visibility='visible'
}


function chgArrayLayer(num) 
{
	oScroll[active].css.visibility='hidden'
	active=num
	oScroll[active].css.top=0
	oScroll[active].css.visibility='visible'
}


var doDynamic = false;
var win = null;
var VISUAL_WIDTH = 585; // Higher
//var VISUAL_WIDTH = 865; // 600x800
var divsCollection;
var thisPage = "";
var divTop = "";

//document.onmouseover  = hideStatus;
window.onresize = handeleResize;

function hideStatus()
{
if (event.srcElement.href)
	{
	 self.status = "";
		return true;
	}
}

function handeleResize()
{
	location.reload();
	return false;
}
function init(page)
{
 thisPage = page;
 win = new Client();
	var left;
	if ((page != "hp") && (page != "CitiesStreets"))
	{
	 document.all.divShow.style.top = divTop;
	}
	divsCollection = document.all.tags('DIV');
	for (i=0;i<divsCollection.length;i++)
	{
	 if (divsCollection[i].title == "לחץ")
		{
		 left = parseInt(divsCollection[i].style.left)
			left += win.l;
			divsCollection[i].style.left = left;
		}
	}
	
	switch (page)
	{
	 case "product":
		 parseXML();
		 if (classesArray.length != 0)
			{ buildOptionsTable(classesArray);	}
			break;
	 case "update":
		 var form = document.forms.reg_update;
				if (form.SALES_BY_EMAIL_YN.value == "Y")
				 form.email_yn_chk.checked = true;
				else
				 form.SALES_BY_EMAIL_YN.value = "N"
		 if (errMsg != "")
			{ setErrMessage();	}
			setUpdateFormValues();
			break;
		case "CitiesStreets":
		 if (document.forms.namesForm.namesSelect.value == 999999)
			{
			 document.submitButton.click();
			}
			else
			{
 		 var obj = window.parent.document.all.dhtmlFrame;
	 		obj.frameborder = 1;
		 	obj.style.display = "inline";//parentTargetFld
				resetParentForm(window.parent.document.forms.reg_update, parentTargetFld, true);
			}
			break;
	 case "reg":
		 var form = document.forms.reg_update;
				if (form.SALES_BY_EMAIL_YN.value == "Y")
				 form.email_yn_chk.checked = true;
				else
				 form.SALES_BY_EMAIL_YN.value = "N"
		 if (errMsg != "")
			{
			 setErrMessage();
			 setUpdateFormValues();
				if (form.BIRTHDAY.value != "")
   	{
				 var bDay = form.BIRTHDAY.value;
					form.BIRTH_YEAR.value = bDay.substring(0,4);
					if (bDay.substring(8,10) == "09")
					 form.BIRTH_DAY.value = bDay.substring(9,10);
					else
 					form.BIRTH_DAY.value = parseInt(bDay.substring(8,10));
					if (bDay.substring(5,7) == "09")
					 form.BIRTH_MONTH.value = bDay.substring(6,7);
					else
					 form.BIRTH_MONTH.value = parseInt(bDay.substring(6,7));
   	}
			}
		 break;
	}
	doDynamic = true;
}

function getWidth()
{
 return document.body.clientWidth;
}

function getHeight()
{
 return document.body.clientHeight;
}

function Client()
{
 this.w = getWidth();
 this.h = getHeight();
 this.l = (Math.floor(this.w/2)) - (Math.floor(VISUAL_WIDTH/2));
 if (this.l < 0) this.l = 0;
}

function setLayer(on, lName, top, left)
{
 if (doDynamic)
	{
	 var dis = (on)? "inline":"none";
	 var obj = document.all[lName].style;
		if (on)
		{
		 obj.top = top;
			obj.left = left+win.l;
		}
		obj.display = dis;
	}
}



/* Start Quantity Functions */

function plus(field_name,form_name)
{
	num=eval('(document.'+form_name+'[field_name].value);');
	
		if((parseInt(num)!= parseInt(num)) || (parseInt(num)>98))     
			{
				numof=eval('(document.'+form_name+'[field_name].value=1);');
				eval('document.'+form_name+'[field_name].value=numof;');
				return true;
			}
		else
			{
			numof=eval('((document.'+form_name+'[field_name].value)*1)+1;');
			eval('document.'+form_name+'[field_name].value=numof;');
			return true;
			}
}

function minus(field_name,form_name)
{
tmp = eval('document.'+form_name+'[field_name].value;');
		if(parseInt(tmp)!= parseInt(tmp))
			{
				numof=eval('(document.'+form_name+'[field_name].value=1);');
				eval('document.'+form_name+'[field_name].value=numof;');
				return true;
			}
		else
			{
				if(tmp == "1")
					{
					}
					else
					{
						numof=eval('((document.'+form_name+'[field_name].value)*1)-1;');
						eval('document.'+form_name+'[field_name].value=numof;');
					}
			}	
  return true;
}


function checkInputValid(qty,form_name)
{

Quan = eval('document.'+form_name+'.qty.value;');

for (var i = 0; i<Quan.length ; i++) 
		{
			 if (Quan.charAt(i)!= parseInt(Quan.charAt(i)) || Quan==0 )
					{	
					alert("נא הזן כמות מתאימה 1-99"); 
					eval('document.'+form_name+'.qty.select();');
					eval('document.'+form_name+'.qty.focus();');
					return false;
					}
		}
		
if(Quan=='')
	{
		alert("נא הזן כמות מתאימה 1-99"); 
		eval('document.'+form_name+'.qty.select();');
		eval('document.'+form_name+'.qty.focus();');
		return false;
	}

	//alert(form_name)
	tmp = eval('document.'+form_name+'[field_name].value;');
	if(tmp=='')
	{
		alert("נא הזן ערך מתאים!")
		eval('document.'+form_name+'.qty.focus();');
		return False;
	}
}

/* End Quantity Functions */


<!--

//Disable right mouse click Script
//By Maximus (maximus@nsimail.com) w/ mods by DynamicDrive
//For full source code, visit http://www.dynamicdrive.com

var message="!הפעולה בוטלה";

///////////////////////////////////
function clickIE4(){
if (event.button==2){
alert(message);
return false;
}
}

function clickNS4(e){
if (document.layers||document.getElementById&&!document.all){
if (e.which==2||e.which==3){
alert(message);
return false;
}
}
}

if (document.layers){
document.captureEvents(Event.MOUSEDOWN);
document.onmousedown=clickNS4;
}
else if (document.all&&!document.getElementById){
document.onmousedown=clickIE4;
}

//document.oncontextmenu=new Function("alert(message);return false")
//document.oncontextmenu=new Function("return false")

// --> 

