﻿//======================================================//
	function addLoadEvent(func) {
	  var oldonload = window.onload;
	  if (typeof window.onload != 'function') {
		window.onload = func;
	  } else {
		window.onload = function() {
		  if (oldonload) {
			oldonload();
		  }
		  func();
		}
	  }
	}
//======================================================//
	function AddLoadEvent(func) {
	  var oldonload = window.onload;
	  if (typeof window.onload != 'function') {
		window.onload = func;
	  } else {
		window.onload = function() {
		  if (oldonload) {
			oldonload();
		  }
		  func();
		}
	  }
	}
//========================================================//
 function OverDomainDIV()
    {
        var str = "<iframe scrolling='no' frameborder='0' width='963' height='63' src='ShortNewsletter.asp' name='Domain' id='Domain'></iframe>"
        var str2 = "<iframe scrolling='no' frameborder='0' width='321' height='304' src='ShortContact.asp' name='ShortContact' id='ShortContact'></iframe>"
        document.getElementById('sContactDIV2').innerHTML = str;
        document.getElementById('sContactDIV').innerHTML = str2;
    }
//========================================================//
function ForumMsg(id, type)
	{
		if(document.getElementById("trfBody"+id).style.display == "none")
		{
			document.getElementById("trfBody"+id).style.display = "";
			document.getElementById("imgForum"+id).className = "minus";
		}
		else
		{
			document.getElementById("trfBody"+id).style.display = "none";
			document.getElementById("imgForum"+id).className = "plus";
		}
	}
	
//======================================================//
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))};
//======================================================//
var myimages = new Array();
function PreloadingImg(){
	for (x=0; x<PreloadingImg.arguments.length; x++){
		myimages[x] = new Image();
		myimages[x].src = PreloadingImg.arguments[x];
	}
}
//======================================================//
	function setHomePage()
	{
		document.body.style.behavior='url(#default#homepage)';
		document.body.setHomePage('http://www.roitech');
	}
    
	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=no,width="+width+",height="+height+",resizable=no");
		wini.window.focus();
	}
	
       

    
    var bookmarkurl="http://www.Bonsite.co.il"
    var bookmarktitle="Roitch"

    function addbookmark(){
    if (document.all)
    window.external.AddFavorite(bookmarkurl,bookmarktitle)
    }
    
   
    function isEmailAddr(email)
    {
    var result = false
    var theStr = new String(email)
    var index = theStr.indexOf("@");
    if (index > 0)
    {
	    var pindex = theStr.indexOf(".",index);
	    if ((pindex > index+1) && (theStr.length > pindex+1))
	    result = true;
    }
    return result;
    }


	    function open_department(id)
	    {
	        document.getElementById("Dep" + id).style.display = 'none';
	        document.getElementById("DepOpen" + id).style.display = '';
	    }

	    function close_department(id)
	    {
	        document.getElementById("Dep" + id).style.display = '';
	        document.getElementById("DepOpen" + id).style.display = 'none';
	    }
	


function Limit()
{
	if(document.all && event.type == "paste")
		this.blur();
	
	if(this.value.length > this.getAttribute("maxi"))
		this.value = this.value.substring(0,this.getAttribute("maxi"));
	$G(this.getAttribute("spani")).innerHTML = this.getAttribute("maxi") - this.value.length;
}
function Maxi()
{
	var ar = document.getElementsByTagName("textarea");
	
	for(var i=0; i < ar.length; i++)
		if(ar[i].getAttribute("maxi") != null)
		{
			ar[i].onpaste = Limit;
			ar[i].onkeyup = Limit;
			ar[i].onblur = Limit;
		}
}
AddLoadEvent(Maxi);

//======================================================//
function EmailValid(val)
{
	var filter = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
	return filter.test(val);
}
//======================================================//
function WaterMark(id, opt, txt, flipDir)
{
	if(document.getElementsByTagName(id).value == ""){document.getElementsByTagName(id).style.color=opt._onblur;document.getElementsByTagName(id).value=txt;}
	document.getElementsByTagName(id).onblur = function(){
		if(document.getElementsByTagName(id).value==""){document.getElementsByTagName(id).value=txt}
		if(document.getElementsByTagName(id).value==txt){document.getElementsByTagName(id).style.color=opt._onblur;if(flipDir){FlipDir(id,opt);}}
	};
	document.getElementsByTagName(id).onfocus = function(){
		if(document.getElementsByTagName(id).value==txt){document.getElementsByTagName(id).value=""}
		document.getElementsByTagName(id).style.color=opt._onfocus;
		if(document.getElementsByTagName(id).value==""){if(flipDir){FlipDir(id,opt);}}
	};
}
function FlipDir(id,opt)
{
	if(document.getElementsByTagName(id).style.direction == "")
		document.getElementsByTagName(id).style.direction = opt.dir;
	if(document.getElementsByTagName(id).style.direction == "rtl")
		document.getElementsByTagName(id).style.direction = "ltr";
	else
		document.getElementsByTagName(id).style.direction = "rtl";
}
//======================================================//
function ClearDiv(divID)
{
	if($(divID))
		$(divID).innerHTML = "";
}
//======================================================//
function HideDiv(divID)
{
	if($(divID))
		$(divID).className = "hidden";
}
//======================================================//
function RefreshUpdatePanel(hiddenFieldID)
{
	var hiddenField = $(hiddenFieldID);
	if (hiddenField) {
		hiddenField.value = (new Date()).getTime();
		__doPostBack(hiddenFieldID,'');
	}
}
function FileName(obj, divID)
{
	if(obj.value != "")
	{
		document.getElementById(divID).innerHTML = obj.value.substring(obj.value.lastIndexOf('\\')+1);

	}
}
    
    
	function show_update(id_no)
	{
	if (document.all('update_' + id_no).style.display=='none') 
	{
	document.all('update_' + id_no).style.display='';
	}
	else 
	{
	document.all('update_' + id_no).style.display='none';
	}
	}
		
function CheckComments()
{
	var regx = /^[a-zA-Z][\w\.-]*[a-zA-Z0-9_]@[a-zA-Z0-9][\w\.-]*[a-zA-Z0-9]\.[a-zA-Z][a-zA-Z\.]*[a-zA-Z]$/;
	
	frm = document.comment;
	if(frm.author_name.value == ""){alert("אנא מלא שם מלא");frm.author_name.focus();return false;}
	if(frm.name.value == ""){alert("אנא מלא כותרת התגובה");frm.name.focus();return false;}
	document.getElementById("Secret").value = "lizzy";
	return true;
}

    ddaccordion.init({
	headerclass: "silverheader", //Shared CSS class name of headers group
	contentclass: "submenu", //Shared CSS class name of contents group
	revealtype: "click", //Reveal content when user clicks or onmouseover the header? Valid value: "click", "clickgo", or "mouseover"
	mouseoverdelay: 200, //if revealtype="mouseover", set delay in milliseconds before header expands onMouseover
	collapseprev: true, //Collapse previous content (so only one open at any time)? true/false
	defaultexpanded: [0], //index of content(s) open by default [index1, index2, etc] [] denotes no content
	onemustopen: false, //Specify whether at least one header should be open always (so never all headers closed)
	animatedefault: false, //Should contents open by default be animated into view?
	persiststate: true, //persist state of opened contents within browser session?
	toggleclass: ["", "selected"], //Two CSS classes to be applied to the header when it's collapsed and expanded, respectively ["class1", "class2"]
	togglehtml: ["", "", ""], //Additional HTML added to the header when it's collapsed and expanded, respectively  ["position", "html1", "html2"] (see docs)
	animatespeed: "fast", //speed of animation: integer in milliseconds (ie: 200), or keywords "fast", "normal", or "slow"
	oninit:function(headers, expandedindices){ //custom code to run when headers have initalized
		//do nothing
	},
	onopenclose:function(header, index, state, isuseractivated){ //custom code to run whenever a header is opened or closed
		//do nothing
	}
})

	function show_bar(id_no)
	{
	if (document.all('bar_' + id_no).style.display=='none') 
	{
	document.all('bar_' + id_no).style.display='';
	}
	else 
	{
	document.all('bar_' + id_no).style.display='none';
	}
	}	

