DOMAIN="http://fulbright.org.il";
IMAGES_ROOT='fileadmin/fulbright/sys/template/images';
IMAGES_ROOT_LANG='fileadmin/fulbright/sys/template/he/images';

/* Replace image src attribute with the "_on" version and vice versa */
function replaceHoverImg(obj)
{
    var s=obj.src;
	var src;

	/* Get the suspected "_on" string */
	var on=s.substr(s.length-7,3);

	/* If the image is NOT the "on" version we turn it to the "on" version */
	if(on!='_on')
	{

		var s1=s.substr(0,s.length-4);
		var s2=s.substr(s.length-4,s.length);
		src=s1+'_on'+s2;

		obj.src=src;
	}
	
	/* If the image is the "on" version we turn it to the NOT "on" version */
	if(on=='_on')
	{
		var s1=s.substr(0,s.length-7);
		var s2=s.substr(s.length-4,s.length);
		src=s1+s2;
		obj.src=src;
	}
}


/* dummy */
function blurLink(){}

function newImage(arg)
{
		rslt = new Image();
		rslt.src = IMAGES_ROOT+arg;
		return rslt;
}

function newImageLang(arg)
{
		rslt = new Image();
		rslt.src = IMAGES_ROOT_LANG+arg;
		return rslt;
}



function stripe()
{
    var even = false;
    var evenColor = arguments[1] ? arguments[1] : '#FFFFFF';
    var oddColor = arguments[2] ? arguments[2] : '#E7F1F7';
	
    var goforit = 0;
    var tables = document.getElementsByTagName('table');

	/* Loop all document the tables */
	for (var k = 0; k < tables.length; k++)
	{
		/* Handle only table_5 class tables */

		if(tables[k].className=='htmlarea-showtableborders table_5')
		{
			var tbodies = tables[k].getElementsByTagName('tbody');
			var mytd;
			var tds 

			for (var h = 0; h < tbodies.length; h++)
			{
				var trs = tbodies[h].getElementsByTagName('tr');

				/* Set the style for the first table row */
				tds = trs[0].getElementsByTagName('td');
				for (j = 0; j < tds.length; j++)
				{
					mytd = tds[j];
					mytd.style.backgroundColor='#67A0BD';
					mytd.style.color='#ffffff';
					mytd.style.fontWeight='bold';
					mytd.style.paddingTop='0px';
					mytd.style.paddingBottom='0px';
				}

				for (var i = 1; i < trs.length; i++)
				{
					even=i%2;

					tds = trs[i].getElementsByTagName('td');

					for (var j = 0; j < tds.length; j++)
					{
						var mytd = tds[j];
						
						mytd.style.backgroundColor = even ? evenColor : oddColor;

						if(i==(trs.length-1))
							//mytd.style.borderBottom="1px solid #67A0BD";
							mytd.style.borderBottom="1px solid #B3CFDE";
					}
				}
			}
		}
	}
}



/* This function scrolls to the #str in the url line if the browser fails to do it */
function goToAnchor()
{
	/* Get the url string */
	var url=this.location+"";

	/* Check if there's a # sign in the url */
	n=url.indexOf('#');

	/* If there's a # sign in the url scroll that location*/
	if(n != "-1")
	{
		len=url.length;
		loc=url.substring(n,len);
		window.location.href=loc;
	}
}
