﻿//======================================================//
	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 overTab(id)
{
document.getElementById("b" + id).style.color="#668826"
document.getElementById("a" + id).style.backgroundImage="url('images/Bar2Hover.jpg')"
}

function overTabOut(id)
{
document.getElementById("b" + id).style.color="#000000"
document.getElementById("a" + id).style.backgroundImage="url('')"
}


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;
}


	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';
	}
	}	

    function hideOld()
    {
	var userInput = document.getElementById('userInput').value;
	document.getElementById('home_' + userInput).style.display='none'
	}

    function show_home(id_no){
	hideOld();
	document.getElementById('home_' + id_no).style.display='';
	document.getElementById('userInput').value = id_no;
	}
	
	
	
function createCookie(name,value,days) {
	if (days) {
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
}

function readCookie(name) {
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}

		
 function picnum(x,y)
    {
        var str = "Image" + x + " Out of" + y
        document.getElementById('sContact').innerHTML = str;
    }

