<!-- the script was writen by Roi Ezra (c) roeie@bezeqint.net, 04-8745818 -->
NewsCat = "news.htm"; // The default catagory for the headlines news..
address = "1_";
cookie_name = "dataCookie";
window_cookie = "NewWindow";
search_cookie = "SearchCookie";
news_cookie = "NewsCookie";
adult_cookie = "AdultCookie";
SearchEngines = new Array("גוגל ישראל", "נענע","וואלה","תפוז","MSN ישראל","Yahoo","Lycos","Mamma","MSN","Google")
var dir;
var color1,color2,NewWindow,Search;
var caution = false;
var bookmarkurl="http://www.100.co.il";
var bookmarktitle="100.co.il";
var now = new Date();

function fixDate(date)
{
	var base = new Date(0)
	var skew = base.getTime()
	if (skew > 0)
		date.setTime(date.getTime() - skew)
}

fixDate(now);
now.setTime(now.getTime() + 31 * 24 * 60 * 60 * 1000);

function addbookmark()
{ 
	if (document.all) 
		window.external.AddFavorite(bookmarkurl,bookmarktitle) 
} 

function SetCookie(name, value, expires, path, domain, secure) 
{
	var curCookie = name + "=" + escape(value) +
	((expires) ? "; expires=" + expires.toGMTString() : "") +
	((path) ? "; path=" + path : "") +
	((domain) ? "; domain=" + domain : "") +
	((secure) ? "; secure" : "")
	if (!caution || (name + "=" + escape(value)).length <= 4000)
		document.cookie = curCookie
	else
		if (confirm("Cookie exceeds 4KB and will be cut!"))
			document.cookie = curCookie
}

function getCookie(name) 
{
	var prefix = name + "="
	var cookieStartIndex = document.cookie.indexOf(prefix)
	if (cookieStartIndex == -1)
		return null
	var cookieEndIndex = document.cookie.indexOf(";", cookieStartIndex + prefix.length)
	if (cookieEndIndex == -1)
		cookieEndIndex = document.cookie.length
	return unescape(document.cookie.substring(cookieStartIndex + prefix.length, cookieEndIndex))
}

NewWindow = getCookie(window_cookie);
Search = getCookie(search_cookie);
if (getCookie(news_cookie)==null)
	NewsCat = "news.htm";
else
	NewsCat = getCookie(news_cookie);
switch (getCookie(cookie_name)) // Init the default colors of each skin of the site (like in the css file)
{
	case 'default': 
	{
		color1="#99CCFF"
		color2="#FFFFFF"
		dir="images";
		break;
	}
	case null:
	{
		color1="#99CCFF"
		color2="#FFFFFF"
		dir="images";
		break;
	}
	case 'red':
	{
		color1="#E5E5E5"
		color2="#FF0000"
		dir="images4";
		break;
	}
	case 'yellow':
	{
		color1="#FFFF33"
		color2="#000099"		
		dir="images2";
		break;
	}
	case 'green':
	{
		color1="#DDEEFF"
		color2="#009933"		
		dir="images3";
		break;
	}
}

function changeCat(newCat)
{
	cat = newCat;
	document.getElementById('roi').src = address + cat;
	document.getElementById('news').style.backgroundColor = color1;	
	document.getElementById('sport').style.backgroundColor = color1;		
	document.getElementById('economy').style.backgroundColor = color1;	
	document.getElementById('entertainment').style.backgroundColor = color1;	
	switch (cat)
	{
		case 'news.htm':	document.getElementById('news').style.backgroundColor = color2; break;
		case 'sport.htm':	document.getElementById('sport').style.backgroundColor = color2; break;
		case 'economy.htm': document.getElementById('economy').style.backgroundColor = color2; break;
		case 'entertainment.htm': document.getElementById('entertainment').style.backgroundColor = color2; break;
	}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.0
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_fFindObj(n,d.layers[i].document);
  if(!x && document.getElementById) x=document.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
//-->

<!-- START OF TIME PRINTING -->

function initArray() {
	for(i=0;i<initArray.arguments.length; i++)
		this[i] = initArray.arguments[i];
}

var isnMonths=new initArray("ינואר","פברואר","מרץ","אפריל","מאי","יוני","יולי","אוגוסט","ספטמבר","אוקטובר","נובמבר","דצמבר");
var isnDays= new initArray("יום ראשון","יום שני","יום שלישי","יום רביעי","יום חמישי","יום שישי","יום שבת","יום ראשון");
today=new Date();
hrs=today.getHours();
min=today.getMinutes();
sec=today.getSeconds();
clckh=""+((hrs>12)?hrs-12:hrs); 
clckm=((min<10)?"0":"")+min;
clcks=((sec<10)?"0":"")+sec;
clck=(hrs>=12)?"p.m.":"a.m.";
var stnr="";
var ns="0123456789";
var a="";
// End Hiding -->

<!-- END OF TIME PRINTING -->

function search_engine()
{
	var engine;
	engine=document.israel_search.search.value;
	engine=Math.round(engine);
	if (document.israel_search.newWindow.checked)
		document.forms[searchForms+engine].target="_blank";
	else
		document.forms[searchForms+engine].target="_self";
	document.forms[searchForms+engine].elements[0].value=document.israel_search.textfield.value;
    document.forms[searchForms+engine].submit();
}

function KeyTrap()
{
	if (event.keyCode==13) //Enter
	{
		document.israel_search.newWindow.checked=true;
		search_engine();
		document.israel_search.newWindow.checked=false;
	}
}

function OpenLink(target)
{
	if (document.israel_search.newWindow.checked)
		window.open(target);
	else
		window.location=target;
}

function PlayGame(url)
{
	var gamewin = window.open('','Game','top=0 left=0 toolbar=no, location=no, status=yes, menubar=no, scrollbars=no, directories=no,width='+(screen.width-80)+', height='+(screen.height-100));
	gamewin.document.write("<html><head>");
	gamewin.document.write("<frameset rows='12%, 88%'>");	
	gamewin.document.write("<frame scrolling=no noresize src=banner.htm>");	
	gamewin.document.write("<frame scrolling=no noresize src="+url+">");	
	gamewin.document.write("</frameset></head></body></html>");
}

// Quick Link
function Quick(x)
{
	if (document.getElementById(x).options[document.getElementById(x).selectedIndex].value!=0)
		OpenLink(document.getElementById(x).options[document.getElementById(x).selectedIndex].value);  
}

function SearchSelect()
{
	document.write("<input type=text size=30 name=textfield onKeyDown='javascript: KeyTrap()'>&nbsp;");
	document.write("<select name=search>");
	for (i=0;i<SearchEngines.length;i++)
	{
		if (i==Search)
			document.write("<option value="+i+" selected>"+SearchEngines[i]+"</option>")
		else
			document.write("<option value="+i+">"+SearchEngines[i]+"</option>")
	}
	document.write("</select>")
}

function AdultOff()
{
	SetCookie(adult_cookie,1,now); 
	window.location = "http://www.100.co.il/";
}

