//////////////BookMarks/////////////////////
function bookmark() {
  window.external.AddFavorite('http://www.useme.co.il', 'Useme - שימושן לאתרים נבחרים בישראל');
}

function set_hompage(){
	document.body.style.behavior='url(#default#homepage)';
	document.body.setHomePage('http://www.useme.co.il/');
}
//////////////BookMarks/////////////////////



////////////// Heb Date /////////////////////
function heb_date(){

	var yKn=[1,0,1,-1,1,0,1,-1,0,1,1,-1,0,1,1,-1,0,1,-1,0,1,
			 1,0,-1,1,0,1,-1,0,1,1,-1,0,1,-1,1,0,1,1,0,-1,1];
	var mHeb=[30,29,30,29,30,0,29,30,29,30,29,30,29];
	var mFgn=[31,28,31,30,31,30,31,31,30,31,30,31];
	var frg=['ינואר','פברואר','מרץ','אפריל','מאי','יוני','יולי'
			,'אוגוסט','ספטמבר','אוקטובר','נובמבר','דצמבר'];
	var arrDays=['','א','ב','ג','ד','ה','ו','ז','ח','ט',''
				,'י','כ','ל','מ','נ','ס','ע','פ','צ','ק'];
	var	arrMonths=['תשרי','חשון','כסלו','טבת','שבט','אדר',
				   'ניסן','אייר','סיון','תמוז','אב','אלול'];
	var	sY=1989,d=', ',w="",m=' ב',y=' ',hebD,hebM,hebY,yn=sY;
	var	dt=new Date(),dy=dt.getDate(),mnt=dt.getMonth();
	var yr=dt.getYear(),wd=dt.getDay(),tmpDiy=355,mntNum=0;
	yr+=1900*(yr<2000); mFgn[1]+=(yr%4==0);
	var pDy=countDays(dy,mnt,yr)-273;
	if (yr%19==0||yr%19==2||yr%19==5||yr%19==8||
	    yr%19==10||yr%19==13||yr%19==16) mHeb[5]=30;
	for (yn=sY;pDy>=tmpDiy;yn++) {
		pDy-=tmpDiy;
		tmpDiy=DIY(yn+1);
	}
	if (yKn[yn-sY]!=0) mHeb[(yKn[yn-sY]+3)%3]+=yKn[yn-sY];
	if ((yr==sY && (mnt>8 || mnt==8 && dy>=30)) || (yr==2030
	   &&(mnt<8 || mnt==8 && dy<29)) || (sY<yr && yr<2030)) {
		for (var i=0;pDy>=mHeb[i];i++) {
			pDy-=mHeb[i];
			if (mHeb[i]!=0)
			   mntNum++;
		}
		hebD=pDy+1;	hebM=mntNum; hebY=yn+3761;
		if (mHeb[5]!=0)
			if (hebM<5) m+=arrMonths[hebM];
			else if (hebM==5 || hebM==6)
					m+="אדר "+arrDays[hebM%4];
				else m+=arrMonths[hebM-1];
		else m+=arrMonths[hebM];
		d+=arrDays[Math.floor(hebD/10)+10];
		if (hebD>10 && hebD%10!=0) d+='"';
		d+=arrDays[hebD%10];
		if (hebD<10 || hebD%10==0) d+="'";
		if (hebD==15||hebD==16)	d=', ט"'+arrDays[hebD-9];
		y+="ה'תש";
		if (hebY%10==0) y+='"';
		y+=arrDays[Math.floor((hebY%5700)/10)+10];
		if (hebY%10!=0) y+='"';
		y+=arrDays[hebY%10];
		if (wd==6) w="שבת";
		else w="יום "+arrDays[wd+1]+"'";
		document.write("<span style=\"cursor:han"+"d\">"+w+d+m+y+", " +dy+" ב"+frg[mnt]+" "+yr+"</span>");
		//onClick=window.open(\"#\")
	}
	else document.write("cannot convert "+dt);
	function countDays(d,m,y){
		var count=0;
		for (var i=sY;i<y;i++)
			count+=365+(i%4==0);
		for (var i=0;i<m;i++)
			count+=mFgn[i];
		return count+d;
	}
	function DIY(y){
		if (y%19==18||y%19==1||y%19==4||
			y%19==7||y%19==9||y%19==12||y%19==15)
			return 384+yKn[y-sY];
		return 354+yKn[y-sY];
	}

}
////////////// End Heb Date /////////////////////


////////////// Web Serch /////////////////////
function $(id) {
	return document.getElementById(id);
}

function web_serch_choice(){
	var form   = $('f1');
	var txt    = $('txt');
	
	var google = $('google');
	var walla  = $('walla');
	var yahoo  = $('yahoo');
	var mako   = $('mako');
	var msn    = $('msn');
	
	if(google.checked == 1){
		$('f1').action="http://www.google.com/search";
		$("txt").name="q";
		
	}else{
		if(walla.checked == 1){
				$('f1').action="http://search.walla.co.il/";
				$("txt").name="q";
		}else{
			    if(yahoo.checked == 1){
			    	$('f1').action="http://search.yahoo.com/search;_ylt=A0oG76Jf_hlMmkAA0Xml87UF";
			    	$("txt").name="q";
		        }else{
		        	    if(mako.checked == 1){
		        	    	$('f1').action="http://www.mako.co.il/Search";
					    	$("txt").name="searchstring_input";
		        	    }else{
		        	    	    if(msn.checked == 1){
		        	    	    	$('f1').action="http://www.bing.com/search";
							    	$("txt").name="q";
		        	    	    }
		        	         }
		        	 }
			 }
		
	}
}

////////////// Web Serch /////////////////////



////////////// Video Serch /////////////////////
function $(id) {
	return document.getElementById(id);
}

function video_serch_choice(){
	var form   = $('f2');
	var txt    = $('txt2');
	
	var youtube = $('youtube');
	var google_vid  = $('google_vid');
	var metacafe  = $('metacafe');
	var flix   = $('flix');
	
	if(youtube.checked == 1){
		$('f2').action="http://www.youtube.com/results";
		$("txt2").name="search_query";
		
	}else{
		if(google_vid.checked == 1){
				$('f2').action="http://www.google.com/search";
				$("txt2").name="q";
		}else{
			    if(metacafe.checked == 1){
			    	$('f2').action="http://www.metacafe.com/results";
			    	$("txt2").name="searchText";
		        }else{
		        		if(flix.checked == 1){
		        	       $('f2').action="http://www.movies-links.tv/search2.php";
						   $("txt2").name="s";
		        	    }
		        	         
		        	 }
			 }
		
	     }
}

////////////// Video Serch /////////////////////







//==============================   Ajax   XMLHttpRequest(GET) =========================================//

//this function return the xmlHTTPobject
function GetXMLHttpRequestObject() {
	var xmlhttpObject;
	if (window.XMLHttpRequest) {
		// code for IE7+, Firefox, Chrome, Opera, Safari
		xmlhttpObject = new XMLHttpRequest();
	} else if (window.ActiveXObject) {
		// code for IE6, IE5
		xmlhttpObject = new ActiveXObject("Microsoft.XMLHTTP");
	} else {
		alert("Your browser does not support XMLHTTP!");
		return false;
	}
	return xmlhttpObject;
}
//==============================   Ajax  XMLHttpRequest(GET)  =========================================//



//////////////Send js id to show by ajax Affilated/////////////////////
//this function will open AJax request and will return the results into //"#table_show" div
function getaffil() {
var ajaxObj = GetXMLHttpRequestObject();

	ajaxObj.onreadystatechange = function() {
		// while ajax request is processing
		if (ajaxObj.readyState < 4) {
			$('table_show').innerHTML = '<div style="width:500px;margin:20px auto 0 auto;text-align:center;"><img src="../media/img/loader.gif" /></div>';
		}
		// when ajax request finished
		if (ajaxObj.readyState == 4) {
			$('table_show').innerHTML = ajaxObj.responseText;
			ajaxObj = null;
		}
	}
	
	a = $('a').name;
	
	ajaxObj.open("GET", "../includes/vv.php?a=" + a,true);
	ajaxObj.send(null);


}
//////////////Send js id to show by ajax Affilated/////////////////////



//////////////Send js id to show by ajax Clients/////////////////////
//this function will open AJax request and will return the results into //"#table_show" div
function getclient() {
var ajaxObj = GetXMLHttpRequestObject();

	ajaxObj.onreadystatechange = function() {
		// while ajax request is processing
		if (ajaxObj.readyState < 4) {
			$('table_show').innerHTML = '<div style="width:500px;margin:20px auto 0 auto;text-align:center;"><img src="../media/img/loader.gif" /></div>';
		}
		// when ajax request finished
		if (ajaxObj.readyState == 4) {
			$('table_show').innerHTML = ajaxObj.responseText;
			ajaxObj = null;
		}
	}
	
	b = $('b').name;

	ajaxObj.open("GET", "../includes/vv.php?b=" + b,true);
	ajaxObj.send(null);

}
//////////////Send js id to show by ajax Clients/////////////////////


//////////////Send js id to show by ajax Students/////////////////////
//this function will open AJax request and will return the results into //"#table_show" div
function getregstud() {
var ajaxObj = GetXMLHttpRequestObject();

	ajaxObj.onreadystatechange = function() {
		// while ajax request is processing
		if (ajaxObj.readyState < 4) {
			$('table_show').innerHTML = '<div style="width:500px;margin:20px auto 0 auto;text-align:center;"><img src="../media/img/loader.gif" /></div>';
		}
		// when ajax request finished
		if (ajaxObj.readyState == 4) {
			$('table_show').innerHTML = ajaxObj.responseText;
			ajaxObj = null;
		}
	}
	
	c = $('c').name;

	ajaxObj.open("GET", "../includes/vv.php?c=" + c,true);
	ajaxObj.send(null);


}
//////////////Send js id to show by ajax Students/////////////////////



//////////////Send js id to show by ajax Dentes/////////////////////
//this function will open AJax request and will return the results into //"#table_show" div
function getregdent() {
var ajaxObj = GetXMLHttpRequestObject();

	ajaxObj.onreadystatechange = function() {
		// while ajax request is processing
		if (ajaxObj.readyState < 4) {
			$('table_show').innerHTML = '<div style="width:500px;margin:20px auto 0 auto;text-align:center;"><img src="../media/img/loader.gif" /></div>';
		}
		// when ajax request finished
		if (ajaxObj.readyState == 4) {
			$('table_show').innerHTML = ajaxObj.responseText;
			ajaxObj = null;
		}
	}
	
	d = $('d').name;

	ajaxObj.open("GET", "../includes/vv.php?d=" + d,true);
	ajaxObj.send(null);

}
//////////////Send js id to show by ajax Dentes/////////////////////



//////////////Send js id to show by ajax Cars/////////////////////
//this function will open AJax request and will return the results into //"#table_show" div
function getregcar() {
var ajaxObj = GetXMLHttpRequestObject();

	ajaxObj.onreadystatechange = function() {
		// while ajax request is processing
		if (ajaxObj.readyState < 4) {
			$('table_show').innerHTML = '<div style="width:500px;margin:20px auto 0 auto;text-align:center;"><img src="../media/img/loader.gif" /></div>';
		}
		// when ajax request finished
		if (ajaxObj.readyState == 4) {
			$('table_show').innerHTML = ajaxObj.responseText;
			ajaxObj = null;
		}
	}
	

	car = $('car').name;


	ajaxObj.open("GET", "../includes/vv.php?car=" + car,true);
	ajaxObj.send(null);


}
//////////////Send js id to show by ajax Cars/////////////////////




//////////////Send js id to show by ajax Visitors/////////////////////
//this function will open AJax request and will return the results into //"#table_show" div
function getvisitor() {
	//x = document.getElementById('someId');

	var ajaxObj = GetXMLHttpRequestObject();
	ajaxObj.onreadystatechange = function() {
		// while ajax request is processing
		if (ajaxObj.readyState < 4) {
			$('table_show').innerHTML = '<div style="width:500px;margin:20px auto 0 auto;text-align:center;"><img src="../media/img/loader.gif" /></div>';
		}
		// when ajax request finished
		if (ajaxObj.readyState == 4) {
			$('table_show').innerHTML = ajaxObj.responseText;
			ajaxObj = null;
		}
	}
	

	e = $('e').name;


	ajaxObj.open("GET", "../includes/vv.php?e=" + e,true);
	ajaxObj.send(null);


}
//////////////Send js id to show by ajax Visitors/////////////////////





//////////////Send js id to delete by ajax /////////////////////
//this function will open AJax request and will return the results into //"#table_show" div
function action_del() {

	var ajaxObj = GetXMLHttpRequestObject();
	ajaxObj.onreadystatechange = function() {
		// while ajax request is processing
		if (ajaxObj.readyState < 4) {
			$('table_show').innerHTML = '<div style="width:500px;margin:20px auto 0 auto;text-align:center;"><img src="../media/img/loader.gif" /></div>';
		}
		// when ajax request finished
		if (ajaxObj.readyState == 4) {
			$('table_show').innerHTML = ajaxObj.responseText;
			ajaxObj = null;
		}
	}
	

	delit = $('delit').name;


	ajaxObj.open("GET", "../includes/vv.php?delit=" + delit,true);
	ajaxObj.send(null);


}
//////////////Send js id to show by ajax Visitors/////////////////////



function open_win()
{
//delit = $('delit').name;
window.open("","_blank","toolbar=yes, location=yes, directories=no, status=no, menubar=yes, scrollbars=yes, resizable=no, copyhistory=yes, width=400, height=400");
}







































//////////////PopUp/////////////////////

var newWindow = null;

function closeWin(){
	if (newWindow != null){
		if(!newWindow.closed)
			newWindow.close();
	}
}

function popUpWin(url, type, strWidth, strHeight){
	
	closeWin();
		
	type = type.toLowerCase();
	
	if (type == "fullscreen"){
		strWidth = screen.availWidth;
		strHeight = screen.availHeight;
	}
	var tools="";
	if (type == "standard") tools = "resizable,toolbar=yes,location=yes,scrollbars=yes,menubar=yes,width="+strWidth+",height="+strHeight+",top=0,left=0";
	if (type == "console" || type == "fullscreen") tools = "resizable,toolbar=no,location=no,scrollbars=no,width="+strWidth+",height="+strHeight+",left=0,top=0";
	newWindow = window.open(url, 'newWin', tools);
	newWindow.focus();
}

function doPopUp(e)
{
//set defaults - if nothing in rel attrib, these will be used
var t = "standard";
var w = "300";
var h = "300";
//look for parameters
attribs = this.rel.split(" ");
if (attribs[1]!=null) {t = attribs[1];}
if (attribs[2]!=null) {w = attribs[2];}
if (attribs[3]!=null) {h = attribs[3];}
//call the popup script
popUpWin(this.href,t,w,h);
//cancel the default link action if pop-up activated
if (window.event) 
	{
	window.event.returnValue = false;
	window.event.cancelBubble = true;
	} 
else if (e) 
	{
	e.stopPropagation();
	e.preventDefault();
	}
}

function findPopUps()
{
var popups = document.getElementsByTagName("a");
for (i=0;i<popups.length;i++)
	{
	if (popups[i].rel.indexOf("popup")!=-1)
		{
		// attach popup behaviour
		popups[i].onclick = doPopUp;
		// add popup indicator
		if (popups[i].rel.indexOf("noicon")==-1)
			{
			popups[i].style.backgroundImage = "url(pop-up.gif)";
			popups[i].style.backgroundPosition = "0 center";
			popups[i].style.backgroundRepeat = "no-repeat";
			popups[i].style.paddingLeft = "15px";
			}
		// add info to title attribute to alert fact that it's a pop-up window
		popups[i].title = popups[i].title + " [Opens in pop-up window]";
		}
	}
}

addEvent(window, 'load', findPopUps, false);






function addEvent(elm, evType, fn, useCapture){
	if(elm.addEventListener){elm.addEventListener(evType, fn, useCapture);return true;}
	else if (elm.attachEvent){var r = elm.attachEvent('on' + evType, fn);return r;}
	else{elm['on' + evType] = fn;}}
//////////////PopUp/////////////////////

