function ImgOn(divId){
	var div	= document.getElementById(divId);
	div.className='ImgOn';
}
function ImgOff(divId){
	var div	= document.getElementById(divId);
	div.className='';
}
var bName = navigator.appName;
var bVer = parseFloat(navigator.appVersion);

function checkStyles(lang)
{
	if (lang == 'AR')
	{
		if(bName=="Netscape"){
			document.write('<link rel="stylesheet" type="text/css" href="public/styles_ar_moz.css">');}
		else{
			document.write('<link rel="stylesheet" type="text/css" href="public/styles_ar.css">');}
	}
	else
	{
		if(bName=="Netscape"){
			document.write('<link rel="stylesheet" type="text/css" href="public/styles_en_moz.css">');
		}
		else{
			document.write('<link rel="stylesheet" type="text/css" href="public/styles_en.css">');
		}

	}
}

//var bName = navigator.appName;
//var bVer = parseFloat(navigator.appVersion);

//function checkStyles()
//{
	//if(bName=="Netscape"){
		//document.write('<link rel="stylesheet" type="text/css" href="public/styles_en_moz.css">');}
	//else{
		//document.write('<link rel="stylesheet" type="text/css" href="public/styles_en.css">');}
//}

function swap(obj, img, activate,langs)
{
	var onOff="";
	var flip=true;
	if(activate)
	{
		onOff="On";
	}
	else
	{
		if(id==img)
			flip=false;
	}
//	alert("images/"+lang+"/M"+img+onOff+".gif");
	if(flip)
	{
//		alert("images/"+lang+"/M"+img+onOff+".gif");
		obj.src="images/"+langs+"/M"+img+onOff+".gif";
	}
}

function Preload(){
	MM_preloadImages('images/AR/M1On.gif','images/AR/M2On.gif','images/AR/M3On.gif','images/AR/M4On.gif','images/AR/M5On.gif','images/AR/M6On.gif','images/AR/M7On.gif','images/AR/left1.gif','images/AR/left1_1.gif','images/AR/left1_2.gif','images/AR/left2_1.gif','images/AR/left2_2.gif','images/AR/left3_1.gif','images/AR/left3_2.gif','images/AR/left4_1.gif','images/AR/left4_2.gif','images/AR/left5_1.gif','images/AR/left5_2.gif','images/AR/left6_1.gif','images/AR/left6_2.gif','images/AR/left7_1.gif',
					 'images/EN/M1On.gif','images/EN/M2On.gif','images/EN/M3On.gif','images/EN/M4On.gif','images/EN/M5On.gif','images/EN/M6On.gif','images/EN/M7On.gif','images/EN/left1.gif','images/EN/left1_1.gif','images/EN/left1_2.gif','images/EN/left2_1.gif','images/EN/left2_2.gif','images/EN/left3_1.gif','images/EN/left3_2.gif','images/EN/left4_1.gif','images/EN/left4_2.gif','images/EN/left5_1.gif','images/EN/left5_2.gif','images/EN/left6_1.gif','images/EN/left6_2.gif','images/EN/left7_1.gif');
}

function MM_preloadImages() {
	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) {
	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_findObj(n,d.layers[i].document);
	if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_showHideLayers() {
	var i,p,v,obj,args=MM_showHideLayers.arguments;
	for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
	if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
	obj.visibility=v; }
}

function P7_Snap() {
	var x,y,ox,bx,oy,p,tx,a,b,k,d,da,e,el,tw,q0,xx,yy,w1,pa='px',args=P7_Snap.arguments;a=parseInt(a);
	if(document.layers||window.opera){pa='';}for(k=0;k<(args.length);k+=4){
	if((g=MM_findObj(args[k]))!=null){if((el=MM_findObj(args[k+1]))!=null){
	a=parseInt(args[k+2]);b=parseInt(args[k+3]);x=0;y=0;ox=0;oy=0;p="";tx=1;
	da="document.all['"+args[k]+"']";if(document.getElementById){
	d="document.getElementsByName('"+args[k]+"')[0]";if(!eval(d)){
	d="document.getElementById('"+args[k]+"')";if(!eval(d)){d=da;}}
	}else if(document.all){d=da;}if(document.all||document.getElementById){while(tx==1){
	p+=".offsetParent";if(eval(d+p)){x+=parseInt(eval(d+p+".offsetLeft"));y+=parseInt(eval(d+p+".offsetTop"));
	}else{tx=0;}}ox=parseInt(g.offsetLeft);oy=parseInt(g.offsetTop);tw=x+ox+y+oy;
	if(tw==0||(navigator.appVersion.indexOf("MSIE 4")>-1&&navigator.appVersion.indexOf("Mac")>-1)){
	ox=0;oy=0;if(g.style.left){x=parseInt(g.style.left);y=parseInt(g.style.top);}else{
	w1=parseInt(el.style.width);bx=(a<0)?-5-w1:-10;a=(Math.abs(a)<1000)?0:a;b=(Math.abs(b)<1000)?0:b;
	x=document.body.scrollLeft+event.clientX+bx;y=document.body.scrollTop+event.clientY;}}
	}else if(document.layers){x=g.x;y=g.y;q0=document.layers,dd="";for(var s=0;s<q0.length;s++){
	dd='document.'+q0[s].name;if(eval(dd+'.document.'+args[k])){x+=eval(dd+'.left');y+=eval(dd+'.top');
	break;}}}e=(document.layers)?el:el.style;xx=parseInt(x+ox+a),yy=parseInt(y+oy+b);
	if(navigator.appVersion.indexOf("MSIE 5")>-1 && navigator.appVersion.indexOf("Mac")>-1){
	xx+=parseInt(document.body.leftMargin);yy+=parseInt(document.body.topMargin);}
	e.left=xx+pa;e.top=yy+pa;}}}
}

function HideAll(){
	MM_showHideLayers('HideAll','','hide','sub1','','hide','sub2','','hide','sub3','','hide','sub4','','hide','sub5','','hide','sub6','','hide','sub10','','hide','sub11','','hide','sub12','','hide','sub13','','hide','sub14','','hide')
}
function setMenu(main, div, left, top)
{
	var width = ((screen.width/8)-8);
	P7_Snap(main, div, left, top);
	document.getElementById(div).style.width = width;
	//alert(width+" - "+document.getElementById(div).style.width);
}

function HideSub1(){
	MM_showHideLayers('HideAll','','hide','sub1','','hide')
}
function HideMenu1(){
	MM_showHideLayers('sub2','','hide','sub3','','hide','sub4','','hide','sub5','','hide','sub6','','hide','sub10','','hide','sub11','','hide','sub12','','hide','sub13','','hide','sub14','','hide')
}
function HideMenu2(){
	MM_showHideLayers('sub1','','hide','sub3','','hide','sub4','','hide','sub5','','hide','sub6','','hide','sub10','','hide','sub11','','hide','sub12','','hide','sub13','','hide','sub14','','hide')
}
function HideMenu3(){
	MM_showHideLayers('sub2','','hide','sub3','','hide','sub1','','hide','sub5','','hide','sub6','','hide','sub10','','hide','sub11','','hide','sub12','','hide','sub13','','hide','sub14','','hide')
}
//function HideMenu10(){
	//MM_showHideLayers('HideAll','','hide','sub2','','hide','sub3','','hide','sub4','','hide','sub5','','hide','sub6','','hide','sub11','','hide','sub12','','hide','sub13','','hide','sub14','','hide')
//}
//function HideMenu11(){
//	MM_showHideLayers('HideAll','','hide','sub2','','hide','sub3','','hide','sub4','','hide','sub5','','hide','sub6','','hide','sub12','','hide','sub13','','hide','sub14','','hide')
//}
//function HideMenu12(){
//	MM_showHideLayers('HideAll','','hide','sub2','','hide','sub3','','hide','sub4','','hide','sub5','','hide','sub6','','hide','sub11','','hide','sub13','','hide','sub14','','hide')
//}
function ShowMenu10(){
	MM_showHideLayers('sub1','','show', 'sub10','','show', 'sub2','','hide', 'sub3','','hide', 'sub4','','hide', 'sub5','','hide', 'sub6','','hide', 'sub11','','hide', 'sub12','','hide', 'sub13','','hide', 'sub14','','hide')
}
function ShowMenu11(){
	MM_showHideLayers('show', 'sub1','','show', 'sub11','','show', 'sub2','','hide', 'sub3','','hide', 'sub4','','hide', 'sub5','','hide', 'sub6','','hide', 'sub10','','hide', 'sub12','','hide', 'sub13','','hide', 'sub14','','hide')
}
function ShowMenu12(){
	MM_showHideLayers('show', 'sub1','','show', 'sub12','','show', 'sub2','','hide', 'sub3','','hide', 'sub4','','hide', 'sub5','','hide', 'sub6','','hide', 'sub10','','hide', 'sub11','','hide', 'sub13','','hide', 'sub14','','hide')
}

function ShowSubMenu(paramid){
document.getElementById(paramid).style.visibility='visible';
}
function ShowSubMenuOut(paramid){
document.getElementById(paramid).style.visibility='hidden';
}




/******** Flash ********/
var requiredVersion = 8;
var useRedirect = false;
var flashPage   = ""
var noFlashPage = ""
var upgradePage = ""
var flash2Installed = false;
var flash3Installed = false;
var flash4Installed = false;
var flash5Installed = false;
var flash6Installed = false;
var flash7Installed = false;
var flash8Installed = false;
var flash9Installed = false;
var maxVersion = 9;
var actualVersion = 0;
var hasRightVersion = false;
var jsVersion = 1.0;

var isIE  = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false;
var isWin = (navigator.appVersion.toLowerCase().indexOf("win") != -1) ? true : false;
jsVersion = 1.1;

if(isIE && isWin){

  document.write('<SCR' + 'IPT LANGUAGE=VBScript\> \n');
  document.write('on error resume next \n');
  document.write('flash2Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.2"))) \n');
  document.write('flash3Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.3"))) \n');
  document.write('flash4Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.4"))) \n');
  document.write('flash5Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.5"))) \n');
  document.write('flash6Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.6"))) \n');
  document.write('flash7Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.7"))) \n');
  document.write('flash8Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.8"))) \n');
  document.write('flash9Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.9"))) \n');
  document.write('<\/SCR' + 'IPT\> \n');

}

function detectFlash() {

  if (navigator.plugins) {
    if (navigator.plugins["Shockwave Flash 2.0"]
        || navigator.plugins["Shockwave Flash"]) {
      var isVersion2 = navigator.plugins["Shockwave Flash 2.0"] ? " 2.0" : "";
      var flashDescription = navigator.plugins["Shockwave Flash" + isVersion2].description;
      var flashVersion = parseInt(flashDescription.substring(16));
      flash2Installed = flashVersion == 2;
      flash3Installed = flashVersion == 3;
      flash4Installed = flashVersion == 4;
      flash5Installed = flashVersion == 5;
      flash6Installed = flashVersion == 6;
      flash7Installed = flashVersion == 7;
      flash8Installed = flashVersion == 8;
      flash9Installed = flashVersion >= 9;
    }
  }
  for (var i = 2; i <= maxVersion; i++) {
    if (eval("flash" + i + "Installed") == true) actualVersion = i;
  }
  if(navigator.userAgent.indexOf("WebTV") != -1) actualVersion = 4;
  if (actualVersion >= requiredVersion) {
    if (useRedirect) {
      if(jsVersion > 1.0) {
        window.location.replace(flashPage);
      } else {
        window.location = flashPage;
      }
    }
    hasRightVersion = true;
  } else {
    if (useRedirect) {
      if(jsVersion > 1.0) {
        window.location.replace((actualVersion >= 2) ? upgradePage : noFlashPage);
      } else {
        window.location = (actualVersion >= 2) ? upgradePage : noFlashPage;
      }
    }
  }
}
detectFlash();

function AC_AddExtension(src, ext)
{
  if (src.indexOf('?') != -1)
    return src.replace(/\?/, ext+'?');
  else
    return src + ext;
}

function AC_Generateobj(objAttrs, params, embedAttrs)
{
  var str = '<object ';
  for (var i in objAttrs)
    str += i + '="' + objAttrs[i] + '" ';
  str += '>';
  for (var i in params)
    str += '<param name="' + i + '" value="' + params[i] + '" /> ';
  str += '<embed ';
  for (var i in embedAttrs)
    str += i + '="' + embedAttrs[i] + '" ';
  str += ' ></embed></object>';

  document.write(str);
}

function AC_FL_RunContent(){
  var ret =
    AC_GetArgs
    (  arguments, ".swf", "movie", "clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
     , "application/x-shockwave-flash"
    );
  AC_Generateobj(ret.objAttrs, ret.params, ret.embedAttrs);
}

function AC_SW_RunContent(){
  var ret =
    AC_GetArgs





    (  arguments, ".dcr", "src", "clsid:166B1BCA-3F9C-11CF-8075-444553540000"
     , null
    );
  AC_Generateobj(ret.objAttrs, ret.params, ret.embedAttrs);
}

function AC_GetArgs(args, ext, srcParamName, classid, mimeType){
  var ret = new Object();
  ret.embedAttrs = new Object();
  ret.params = new Object();
  ret.objAttrs = new Object();
  for (var i=0; i < args.length; i=i+2){
    var currArg = args[i].toLowerCase();

    switch (currArg){
      case "classid":
        break;
      case "pluginspage":
        ret.embedAttrs[args[i]] = args[i+1];
        break;
      case "src":
      case "movie":
        args[i+1] = AC_AddExtension(args[i+1], ext);
        ret.embedAttrs["src"] = args[i+1];
        ret.params[srcParamName] = args[i+1];
        break;
      case "onafterupdate":
      case "onbeforeupdate":
      case "onblur":
      case "oncellchange":
      case "onclick":
      case "ondblClick":
      case "ondrag":
      case "ondragend":
      case "ondragenter":
      case "ondragleave":
      case "ondragover":
      case "ondrop":
      case "onfinish":
      case "onfocus":
      case "onhelp":
      case "onmousedown":
      case "onmouseup":
      case "onmouseover":
      case "onmousemove":
      case "onmouseout":
      case "onkeypress":
      case "onkeydown":
      case "onkeyup":
      case "onload":
      case "onlosecapture":
      case "onpropertychange":
      case "onreadystatechange":
      case "onrowsdelete":
      case "onrowenter":
      case "onrowexit":
      case "onrowsinserted":
      case "onstart":
      case "onscroll":
      case "onbeforeeditfocus":
      case "onactivate":
      case "onbeforedeactivate":
      case "ondeactivate":
      case "type":
      case "codebase":
        ret.objAttrs[args[i]] = args[i+1];
        break;
      case "width":
      case "height":
      case "align":
      case "vspace":
      case "hspace":
      case "class":
      case "title":
      case "accesskey":
      case "name":
      case "id":
      case "tabindex":
        ret.embedAttrs[args[i]] = ret.objAttrs[args[i]] = args[i+1];
        break;
      default:
        ret.embedAttrs[args[i]] = ret.params[args[i]] = args[i+1];
    }
  }
  ret.objAttrs["classid"] = classid;
  if (mimeType) ret.embedAttrs["type"] = mimeType;
  return ret;
}



/********* End Flash***********/


/*News*/

CurrentPhoto = 1;  //start at photo 1 - Welcome Image
MaxPhoto = 3;     //maximum number of photos represented
MinPhoto = 1;
PhotosArray = new Array ();
TextArray = new Array ();
HeadArray = new Array ();
LinkArray = new Array ();
PicsArray = new Array ();
HeadArray2 = new Array ();
LinkArray2 = new Array ();
SelectedArray = new Array ();
SelectedImageArray = new Array ();
SelectedLinkArray = new Array ();

var news_timeout;
function slideNews(more, langs)
{
	NextPhoto(more, langs, 1);
	news_timeout = setTimeout('slideNews(\''+more+'\',\''+langs+'\')', 6000); //6 seconds
}

function changeNews()
{
	NextNews(1);
	news_timeout = setTimeout('changeNews()', 6000); //6 seconds
}
function NextNews()
{
		document.getElementById('selected_id_'+CurrentPhoto).className = "Off";

	if (CurrentPhoto == MaxPhoto)
		CurrentPhoto = 1;  // go back to first hole
	else
		CurrentPhoto++;

		var imgs = '';
		document.getElementById('selected_id_'+CurrentPhoto).className = "On";
		document.getElementById('newsPic').src = SelectedImageArray[CurrentPhoto - 1];
		document.getElementById('imglink').href = SelectedLinkArray[CurrentPhoto - 1];
		/*
		if (PhotosArray[CurrentPhoto] == 'admin/images/banner/')
			imgs = PhotosArray[CurrentPhoto]+'default_banner.png';
		else
			imgs = PhotosArray[CurrentPhoto];

	document.getElementById('showphoto').src = imgs;
	document.getElementById('headlineLink').href = LinkArray [CurrentPhoto];
	document.getElementById('photoLink').href = LinkArray [CurrentPhoto];

	document.getElementById('ShowText').innerHTML = TextArray[CurrentPhoto]+"... <span id=\"Blue2\" class=\"Tahoma Size11\"><a href="+LinkArray [CurrentPhoto]+"><img src=\"images/common/arrow.gif\" alt=\"\"></a></span>";
	document.getElementById('Headline').innerHTML = HeadArray[CurrentPhoto];
	document.getElementById('small'+(CurrentPhoto)).className="SmallPicOn";
	*/
}

/*var news_time = 6;
var news_timer = news_time;

function slideNews(more)
{
	if(news_timer > 0)
	{
		news_timer -= 1;
		setTimeout('slideNews(\''+more+'\')',1000);
	}
	else{
		NextPhoto(more);
		news_timer = news_time;
		slideNews(more)
	}
}*/

function NextPhoto(more, langs, next)
{
	//document.getElementById('small'+(CurrentPhoto)).className="SmallPic";
	var prevPhoto = 1;
	var isMax = false;
	if (next == 1 && CurrentPhoto == MaxPhoto)
	{
		prevPhoto = 3;
		CurrentPhoto = 1;  // go back to first hole
		isMax = true;
	}
	else if (next == 0 && CurrentPhoto == MinPhoto)
		CurrentPhoto = 1;  // go back to first hole
	else if (next == 0)
	{
		prevPhoto = CurrentPhoto;
		CurrentPhoto = CurrentPhoto - 1;  // go back to first hole
	}
	else
	{
		prevPhoto = CurrentPhoto;
		CurrentPhoto++;
	}
			//document.getElementById('entry'+CurrentPhoto).className = 'ColorSelected FontSize13 Tahoma';
			//document.getElementById('selectedTD'+CurrentPhoto).className = 'PaddListH blueBackground';

			/* disable the arrow display */
		//	document.getElementById('selected'+CurrentPhoto).innerHTML = '<img src="images/'+langs+'/arrow-select.png" alt="">';
			//document.getElementById('selectedTD'+CurrentPhoto).className = 'PaddListH BorderWhite';


		if (CurrentPhoto != prevPhoto)
		{
			/* disable the arrow display */
		//	document.getElementById('selected'+prevPhoto).innerHTML = '';
			//document.getElementById('entry'+prevPhoto).className = 'ColorTop FontSize13 Tahoma';


			//document.getElementById('selectedTD'+prevPhoto).className = 'PaddListH BorderTick';
		}
		var imgs = '';
		if (PhotosArray[CurrentPhoto] == 'admin/images/banner/')
			imgs = PhotosArray[CurrentPhoto]+'default_banner.png';
		else
			imgs = PhotosArray[CurrentPhoto];

	document.getElementById('showphoto').src = imgs;
	//document.getElementById('showphoto').src = "images/common/2009elections.jpg";
//	document.getElementById('imgLink').href = LinkArray[CurrentPhoto];
//	if (CurrentPhoto == 4)
//	{
//		document.getElementById('showphoto').src = "images/common/2009elections.jpg";
//		document.getElementById('imgLink').href = "http://www.elections.gov.lb/Elections-Results/2009-Real-time-Results.aspx";
//		document.getElementById('imgLink').target = "_blank";
//		document.getElementById('selectedTD'+CurrentPhoto).className = 'PaddListSit blueBackground';
//
//	}

	document.getElementById('headlineLink').href = LinkArray [CurrentPhoto];
	document.getElementById('photoLink').href = LinkArray [CurrentPhoto];

	//document.getElementById('ShowText').innerHTML = TextArray[CurrentPhoto]+"... <span id=\"Blue2\" class=\"Tahoma Size11\"><a href="+LinkArray [CurrentPhoto]+"><img src=\"images/"+langs+"/arrows.gif\" alt=\"\"></a></span>";
	document.getElementById('Headline').innerHTML = HeadArray[CurrentPhoto];
	document.getElementById('small'+(CurrentPhoto)).className="SmallPicOn";
	//opacity('showphoto', 30, 100, 1000);
}

function opacity(id, opacStart, opacEnd, millisec) {
    var speed = Math.round(millisec / 100);
    var timer = 0;
    if(opacStart > opacEnd) {
        for(i = opacStart; i >= opacEnd; i--) {
            t=setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
            timer++;
        }
    } else if(opacStart < opacEnd) {
        for(i = opacStart; i <= opacEnd; i++)
            {
            t=setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
            timer++;
        }
    }
}

function changeOpac(opacity, id) {
    var object = document.getElementById(id).style;
    object.opacity = (opacity / 100);
    object.MozOpacity = (opacity / 100);
    object.KhtmlOpacity = (opacity / 100);
    object.filter = "alpha(opacity=" + opacity + ")";
}

function News(id,more,langs)
{
	for(i=1;i<4;i++){
		document.getElementById('small'+i).className="SmallPic";
	}

	CurrentPhoto = id;

	var imgs = '';
	if (PhotosArray[CurrentPhoto] == 'admin/images/banner/')
		imgs = PhotosArray[id]+'default_banner.png';
	else
		imgs = PhotosArray[id];

	document.getElementById('showphoto').src = imgs;
	document.getElementById('headlineLink').href = LinkArray [id];
	document.getElementById('photoLink').href = LinkArray [id];
	//document.getElementById('ShowText').innerHTML = TextArray[id]+"... <span id=\"Blue2\" class=\"Tahoma Size11\"><a href="+LinkArray[id]+"><img src=\"images/"+langs+"/arrows.gif\" alt=\"\"></a></span>";
	document.getElementById('Headline').innerHTML = HeadArray [id];
	document.getElementById('small'+id).className="SmallPicOn";

	//news_timer = 10;
	clearTimeout(news_timeout);
	news_timeout = setTimeout('slideNews(\''+more+'\',\''+langs+'\')', 8000); //6 seconds
}

/*End News*/


function BiggerText(){
	document.getElementById('Text').style.fontSize=14;
}
function NormalText(){
	document.getElementById('Text').style.fontSize=11;
}
//Define the fontSize, font variation per click and the minimum font size
var fontVariation=2;
var minFontSize=11;
var maxFontSize=19;
function enlargeFont(bigger)
{
	var elements=document.getElementById('Text');
	var newFontSize="";
		newFontSize=elements.style.fontSize;
		if(newFontSize=="")
			newFontSize=minFontSize;
			newFontSize=parseInt(newFontSize);

		if(bigger)
			newFontSize=(newFontSize<maxFontSize)?(newFontSize+fontVariation):(maxFontSize);
		else
			newFontSize=(newFontSize>minFontSize)?(newFontSize-fontVariation):(newFontSize);

	elements.style.fontSize=newFontSize+'px';
}
/*function bookmark1()
{

	if (navigator.appName != 'Microsoft Internet Explorer' )
	{
		window.sidebar.addPanel(document.title,location.href,"");
	}
	else
	{
		window.external.AddFavorite(location.href, document.title);
	}
}*/

function bookmark1()
{
	var browser = BrowserDetect.browser;

	if(browser == 'Safari')
		alert('You need to press CTRL + D to bookmark our site.');
	else
	{
		if (navigator.appName != 'Microsoft Internet Explorer')
		{
			window.sidebar.addPanel(document.title,location.href,"");
		}
		else
		{
			window.external.AddFavorite(location.href, document.title);
		}
	}
}

/* AJAX function to send articles */
function share_article(type, id, lang) {
	var bubble = new pop_bubble('share_pop_bubble');
	bubble.show_ajax_bubble(type, id, lang);
	return false;
}

tempObj = null;













function setFontSize(objWanted,sizeWanted)
{
	//Get all the HTML elements from the page
	var objW=document.getElementById(objWanted);

	try
	{
		//Change the font size of an element
		objW.style.fontSize=sizeWanted+'px';
	}
	catch(e)
	{
		;
	}
}

function filePopUp(file_id, type, id, width, height)
{
  if(!width) var width="720";
  if(!height) var height="740";
  var left = (screen.width/2) - width/2;
  var top = 10;
  var styleStr = 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbar=no,resizable=yes,copyhistory=yes,width='+width+',height='+height+',left='+left+',top='+top+',screenX='+left+',screenY='+top;
  var msgWindow = window.open("file_popup.php?FileID="+file_id+"&Type="+type+"&ID="+id,"msgWindow", styleStr);
  return false;
}

/**** Ajax Functions */

function submitSubscribeForm()
{
	xajax_wait();
	xajax_Subscribe(xajax.getFormValues("subscribeform"));
	return false;
}

function submitContactForm()
{
	xajax_wait();
	xajax_Contact(xajax.getFormValues("contactform"));
	return false;
}

function submitEmailForm()
{
	xajax_MailArticle(xajax.getFormValues("emailform"));
	return false;
}

function submitCommentForm()
{
	xajax_wait();
	xajax_Comment(xajax.getFormValues("commentform"));
	return false;
}

function submitVoteForm()
{
	xajax_pollVote(xajax.getFormValues("pollform"));
	return false;
}

/* AJAX function to send articles */
function share_article(type, id, lang) {
	var bubble = new pop_bubble('share_pop_bubble');
	bubble.show_ajax_bubble(type, id, lang);
	return false;
}

tempObj = null;

/* AJAX function to view medi bubbles */
function show_media(id, type, t_id) {
	var bubble = new pop_bubble('share_pop_bubble');
	bubble.show_media_bubble(id, type, t_id);
	tempObj = bubble;
	checkPopPosition(tempObj);
	return false;
}

/* AJAX function to print articles */
/*function print_article(type, id)
{
	xajax_wait();
	xajax_PrintArticle(type, id);
	return false;
}*/

function print_article(type, id)
{
//	xajax_wait();
//	xajax_PrintArticle(type, id);
//	return false;
	if(!width) var width="580";
	if(!height) var height="560";
	var left = (screen.width/2) - width/2;
	var top = 10;
	var styleStr = 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,copyhistory=yes,width='+width+',height='+height+',left='+left+',top='+top+',screenX='+left+',screenY='+top;
	var msgWindow = window.open("print_popup.php?Type="+type+"&ID="+id, "msgWindow", styleStr);
	return false;
}

/* AJAX function to show intro */
function show_intro(lang)
{
	var bubble = new pop_bubble('share_pop_bubble');
	bubble.show_intro(lang);
	return false;
}


var pop_timeout;
function checkPopPosition(tempObj) {
	tempObj.reset_bubble();
	//alert(tempObj.popup.style.left);
	pop_timeout = setTimeout('checkPopPosition(tempObj)', 1);
}

function print_function(content_vlue)
{
	var disp_setting="toolbar=no,location=no,directories=no,menubar=no,";
		disp_setting+="scrollbars=yes,width=600, height=500, left=100, top=100";
	//var content_vlue = document.getElementById("print_content").innerHTML;

	var docprint=window.open("","",disp_setting);

	docprint.document.open();
	docprint.document.write('<html><head><title>Al-Mustaqbal</title>');
	docprint.document.write('</head><body onLoad="self.print(); self.close();" style="margin:0px;padding:0px;"><center>');
	docprint.document.write(content_vlue);
	docprint.document.write('</center></body></html>');
	docprint.document.close();
 	docprint.focus();
}

function contactForm()
{
	var subject = document.all["type_id"].value;
	var sector = document.all["sector_div"];
	var interview = document.all["interview_div"];
	var city = document.all["city_div"];
	var feedback_span = document.all["feedback_span"];
	var summary_span = document.all["summary_span"];

	if(subject == 4)
	{
		sector.style.display = 'none';
		interview.style.display = '';
		city.style.display = '';
		feedback_span.style.display = 'none';
		summary_span.style.display = '';
	}
	else if(subject == 6)
	{
		sector.style.display = '';
		interview.style.display = 'none';
		city.style.display = '';
		feedback_span.style.display = '';
		summary_span.style.display = 'none';
	}
	else
	{
		sector.style.display = 'none';
		interview.style.display = 'none';
		city.style.display = 'none';
		feedback_span.style.display = '';
		summary_span.style.display = 'none';
	}
}



function getURLParam(strParamName)
{
	var strReturn = "";
	var strHref = window.location.href;
	if ( strHref.indexOf("?") > -1 )
	{
		var strQueryString = strHref.substr(strHref.indexOf("?")).toLowerCase();
		var aQueryString = strQueryString.split("&");
		for ( var iParam = 0; iParam < aQueryString.length; iParam++ )
		{
			if ( aQueryString[iParam].indexOf(strParamName.toLowerCase() + "=") > -1 )
			{
				var aParam = aQueryString[iParam].split("=");
				strReturn = aParam[1];
				break;
			}
		}
	}
	return unescape(strReturn);
}

function checkResolution(page)
{
	if(screen.width <= 800)
		top.location.href=page+'&res=1';
}


function toggleProcedure(currProcedure, src, show_all, hide_all)
{
	var version = navigator.appVersion;
	if (version.indexOf("Windows") != -1)
	{
		thisProcedure = document.getElementById("procedure"+currProcedure).style;
		thisExpander = document.getElementById("expander"+currProcedure);
		thisText = document.getElementById("text"+currProcedure);

		if (thisProcedure.display == "block")
		{
			thisProcedure.display = "none";
			thisExpander.src = "images/"+src+"/expand.gif";
			thisText.innerHTML = show_all;
		}
		else
		{
			thisProcedure.display = "block";
			thisExpander.src = "images/"+src+"/collapse.gif";
			thisText.innerHTML = hide_all;
		}
	}
	return false
}

//popup for flash loccator

function openNewWindow(URLtoOpen, windowName, windowFeatures) {
	newWindow=window.open(URLtoOpen, windowName, windowFeatures);
}
function ChangeImage(id,img,lang)
{
		var div1=document.getElementById(id);
		div1.src="images/"+img+".gif";

}
function refreshNews(lang_id,lang_more)
{
	document.getElementById('Block7').innerHTML = '<img src="images/common/ajaxloader.gif">';
	xajax_getLatestBreaking_html(lang_id);
}

function popitup()
{
	var left = (screen.width/2) - width/2;
	var top = (screen.height/2) - height/2;
	var width="480", height="295";
	var styleStr = 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,width='+width+',height='+height+',left='+left+',top='+top+',screenX='+left+',screenY='+top;

	newwindow=window.open("belmart.php",'printWindow',"");

	if (window.focus) {newwindow.focus()}

	return false;
}
function popupwindow(url,popupname,parameters)
{
	window.open(url,popupname,'height=250,width=355,top=0,left=0,resizable=no,scrollbars=no');
}
function popupBanner(url,popupname)
{
	window.open(url,popupname,'height=815,width=580,top=0,left=0,resizable=no,scrollbars=no');
}

function print_candidates(id)
{
    xajax_PrintCandidates(id);
    return false;
}

function print_functionCandidate(content_vlue)
{
    var disp_setting="toolbar=no,location=no,directories=no,menubar=no,";
        disp_setting+="scrollbars=yes,width=220, height=400, left=100, top=100";
    //var content_vlue = document.getElementById("print_content").innerHTML;

    var docprint=window.open("","",disp_setting);

    docprint.document.open();
    docprint.document.write('<html><head><title>Al-Mustaqbal</title>');
    docprint.document.write('</head><body onLoad="self.print();" style="margin:0px;padding:0px;"><center>');
    docprint.document.write(content_vlue);
    docprint.document.write('</center></body></html>');
    docprint.document.close();
    docprint.focus();
}
function validateQuick()
{
	var name3 = document.getElementById('name3');
	var rec = document.getElementById('rec');
	var err     = document.getElementById('quick_errs');
	if(name3.value.Trim() == '')
	{
		alert("Please enter full name.");
		return false;
//	//	name3.focus();
//		err.innerHTML = '&#1575;&#1604;&#1585;&#1580;&#1575;&#1569; &#1571;&#1583;&#1582;&#1604; &#1575;&#1604;&#1573;&#1587;&#1605; &#1575;&#1604;&#1579;&#1604;&#1575;&#1579;&#1610;';
//
	}
	else if(rec.value.Trim() == '' || isNaN(rec.value))
	{
		alert("Please enter a valid record number");
		return false;
//		//rec.focus();
//		err.innerHTML = '&#1575;&#1604;&#1585;&#1580;&#1575;&#1569; &#1571;&#1583;&#1582;&#1604; &#1585;&#1602;&#1605; &#1575;&#1604;&#1587;&#1580;&#1604;';
	}
	else
	{
		var disp_setting="toolbar=no,location=no,directories=no,menubar=no,";
        disp_setting+="scrollbars=yes,width=520, height=270, left=100, top=100";
//		//xajax_submitQuick(xajax.getFormValues('quickform'));
		window.open("http://www.almustaqbal.org/Elections/quick_popup.php?n="+name3.value+"&r="+rec.value,"",disp_setting);
	}
}

String.prototype.Trim = function()
{
	return this.replace( /(^\s*)|(\s*$)/g,'');
}

function setHomepage()
{
 if (document.all)
    {
        document.body.style.behavior='url(#default#homepage)';
  document.body.setHomePage('http://www.almustaqbal.org');

    }
    else if (window.sidebar)
    {
    if(window.netscape)
    {
         try
   {
            netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
         }
         catch(e)
         {
    alert("this action was aviod by your browser?if you want to enable?please enter about:config in your address line,and change the value of signed.applets.codebase_principal_support to true");
         }
    }
    var prefs = Components.classes['@mozilla.org/preferences-service;1'].getService(Components. interfaces.nsIPrefBranch);
    prefs.setCharPref('browser.startup.homepage','http://www.almustaqbal.org');
 }
}

var BrowserDetect = {
	init: function () {
		this.browser = this.searchString(this.dataBrowser) || "An unknown browser";
		this.version = this.searchVersion(navigator.userAgent)
			|| this.searchVersion(navigator.appVersion)
			|| "an unknown version";
		this.OS = this.searchString(this.dataOS) || "an unknown OS";
	},
	searchString: function (data) {
		for (var i=0;i<data.length;i++)	{
			var dataString = data[i].string;
			var dataProp = data[i].prop;
			this.versionSearchString = data[i].versionSearch || data[i].identity;
			if (dataString) {
				if (dataString.indexOf(data[i].subString) != -1)
					return data[i].identity;
			}
			else if (dataProp)
				return data[i].identity;
		}
	},
	searchVersion: function (dataString) {
		var index = dataString.indexOf(this.versionSearchString);
		if (index == -1) return;
		return parseFloat(dataString.substring(index+this.versionSearchString.length+1));
	},
	dataBrowser: [
		{
			string: navigator.userAgent,
			subString: "Chrome",
			identity: "Chrome"
		},
		{ 	string: navigator.userAgent,
			subString: "OmniWeb",
			versionSearch: "OmniWeb/",
			identity: "OmniWeb"
		},
		{
			string: navigator.vendor,
			subString: "Apple",
			identity: "Safari"
		},
		{
			prop: window.opera,
			identity: "Opera"
		},
		{
			string: navigator.vendor,
			subString: "iCab",
			identity: "iCab"
		},
		{
			string: navigator.vendor,
			subString: "KDE",
			identity: "Konqueror"
		},
		{
			string: navigator.userAgent,
			subString: "Firefox",
			identity: "Firefox"
		},
		{
			string: navigator.vendor,
			subString: "Camino",
			identity: "Camino"
		},
		{		// for newer Netscapes (6+)
			string: navigator.userAgent,
			subString: "Netscape",
			identity: "Netscape"
		},
		{
			string: navigator.userAgent,
			subString: "MSIE",
			identity: "Explorer",
			versionSearch: "MSIE"
		},
		{
			string: navigator.userAgent,
			subString: "Gecko",
			identity: "Mozilla",
			versionSearch: "rv"
		},
		{ 		// for older Netscapes (4-)
			string: navigator.userAgent,
			subString: "Mozilla",
			identity: "Netscape",
			versionSearch: "Mozilla"
		}
	],
	dataOS : [
		{
			string: navigator.platform,
			subString: "Win",
			identity: "Windows"
		},
		{
			string: navigator.platform,
			subString: "Mac",
			identity: "Mac"
		},
		{
			string: navigator.platform,
			subString: "Linux",
			identity: "Linux"
		}
	]

};
BrowserDetect.init();

