function addbookmark() {
	url = "http://www.domain.com";
	title = "שם האתר";
	if (window.sidebar) { // Mozilla Firefox Bookmark
		window.sidebar.addPanel(title, url,""); 
		return false;  
		} else if (window.external) { // IE Favorite      
		window.external.AddFavorite( url, title);     
		return false;       
		} else if (window.opera && window.print) { // Opera Hotlist  
		var elem = document.createElement('a');    
		elem.setAttribute('href',url);            
		elem.setAttribute('title',title);           
		elem.setAttribute('rel','sidebar');     
		elem.click();         
		return false;    
		}
	}
	
function homePage(){
	document.body.style.behavior='url(#default#homepage)';
	document.body.setHomePage('http://www.domain.com');
	}
	
function gid(gelement) {
	return document.getElementById(gelement);
	}

function confirmation(txt,link) {
	UserConfirm=confirm(txt);
	if (UserConfirm==true) location.href = link;
	return (UserConfirm);
	}

function NewWin(location, name,w, h, scr) {
	window.open(location, name, 'width='+w+', height='+h+', scrollbars='+scr+', top='+((screen.height / 4)-(h / 2))+', left='+((screen.width / 4) - (w / 2)));
	}

function ShowDiv(stylefeild) {
	if (document.getElementById(stylefeild).style.display=='none')
		document.getElementById(stylefeild).style.display='block';
	else
		document.getElementById(stylefeild).style.display='none';
	}
	
function ShowField(stylefeild,chkfield,index) {
	var obj = document.getElementById(stylefeild);
	var objj = document.getElementById(chkfield);
	obj.style.display='none';
	if (objj.options[objj.selectedIndex].value == index) obj.style.display='block';
	}

function selectAll() {
	var arr = document.getElementsByTagName("input");
	for (i=0;i<arr.length;i++) arr[i].checked=true;
	}

function unselectAll() {
	var arr = document.getElementsByTagName("input");
	for (i=0;i<arr.length;i++) arr[i].checked=false;
	}
	
function ajax(url,target) {
	var xmlHttp;
	try {  // Firefox, Opera 8.0+, Safari
		xmlHttp=new XMLHttpRequest();  }
		catch (e) {  // Internet Explorer 
			try {
				xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
			} catch (e) {
				try {
					xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
				} catch (e) {
				alert("Your browser does not support AJAX!");
				return false;
				}
			}
		}

	xmlHttp.onreadystatechange=function() {
		if (xmlHttp.readyState == 4) {
			if (gid(target)) gid(target).innerHTML = xmlHttp.responseText;
			}
		}
	if (gid(target)) {
		xmlHttp.open("POST",url,true);
		} else {
		xmlHttp.open("POST",url,false);
		}
	xmlHttp.send(null); 
	if (!gid(target)) return xmlHttp.responseText;
	}

function RoundToNdp(X, N){
		var T = Number('1e'+N);
		return Math.round(X*T)/T;
	}
	
function numbersOnly(e,o) {
	var ev = (window.event) ? window.event : o;
	var key= (ev.keyCode)? ev.keyCode: ((ev.charCode)? ev.charCode: ev.which);
	if (key < 48 || key > 57) return false;
	// onkeypress="return numbersOnly(this,event);" onpaste="return false"
	}

function lettersOnly(e,o) {
	var ev = (window.event) ? window.event : o;
	var key= (ev.keyCode)? ev.keyCode: ((ev.charCode)? ev.charCode: ev.which);
	if (key < 48 || key > 57)
                      if (key < 97 || key >122)
                      if (key < 65 || key > 90)
		return false;
	//  onkeypress="return lettersOnly(this,event);" onpaste="return false"
	}

function chkMail(str) {
	var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
	if (reg.test(str) == false) return false; else return true;
	}
	
function moveMultiple(fromSelect,toSelect,strongField,updateInput) {
	var totalItems = gid(fromSelect).options.length;
	for (i=totalItems -1; i >= 0;i--) {
		if (gid(fromSelect).options[i].selected) {
			var newOption = document.createElement('option');
			newOption.text = gid(fromSelect).options[i].text;
			newOption.value = gid(fromSelect).options[i].value;
			gid(toSelect).add(newOption);
			gid(fromSelect).remove(i);
			}
		}
	var totalNewItems = gid(strongField).options.length;
	var listArr = new Array();
	for (i=totalNewItems-1; i >= 0;i--) listArr[i] = gid(strongField).options[i].value;
	gid(updateInput).value = listArr.join(",");
	}
