var prefsLoaded = false;
var defaultFontSize =75;
var currentFontSize = defaultFontSize;

				
function revertStyles(){

	currentFontSize = defaultFontSize;
	changeFontSize(0);

}

function changeFontSize(sizeDifference){
	currentFontSize = parseInt(currentFontSize) + parseInt(sizeDifference * 10);

	if(currentFontSize > 120){
		currentFontSize = 120;
	}else if(currentFontSize < 70){
		currentFontSize = 70;
	}

	setFontSize(currentFontSize);
	//alert(readCookie("fontSize"));
}

function setFontSize(fontSize){
	var stObj = (document.getElementById) ? document.getElementById('content_area') : document.all('content_area');
	document.body.style.fontSize = fontSize + '%';
	//alert (document.body.style.fontSize);
}

function createCookie(name,value,days) {
  if (days) {
    var date = new Date();
    //date.setTime(date.getTime()+(days*24*60*60*1000));
	date.setDate(date.getDate()+days);
	date.setHours(0,0,0,0);
    var expires = "; expires="+date.toGMTString();
  }
  else expires = "";
  document.cookie = name+"="+value+expires+"; path=/";
}


function inchideLampa(){
	document.getElementById("lampa").style.display="none";
	
	}
function setMarginLampa(){
		//define universal reference to "staticcontent"
		var crossobj=document.all? document.all.lampa : document.getElementById("lampa")
		
		//define reference to the body object in IE
		var iebody=(document.compatMode && document.compatMode != "BackCompat")? document.documentElement : document.body
		
				//define universal dsoc left point
		var dsocleft=document.all? iebody.scrollLeft : pageXOffset
		//define universal dsoc top point
		var dsoctop=document.all? iebody.scrollTop : pageYOffset
		
		var left_space=((document.documentElement.clientWidth?document.documentElement.clientWidth:document.body.clientWidth)-950)/2-180;
		//alert(left_space);
		document.getElementById("lampa").style.left=((950+left_space)<1024)?left_space+950+"px":left_space+1200+"px";
		
		//if the user is using IE 4+ or Firefox/ NS6+
		if (document.all||document.getElementById){
		//crossobj.style.left=parseInt(dsocleft)+950+"px"
		crossobj.style.top=dsoctop+250+"px"
		}
		
		
		/*var left_space=((document.documentElement.clientWidth?document.documentElement.clientWidth:document.body.clientWidth)-950)/2-180;
		//alert(left_space);
		document.getElementById("lampa").style.left=((950+left_space)<1024)?left_space+950+"px":left_space+1200+"px";
		document.getElementById("lampa").style.top="650px";
		*/
		setTimeout("setMarginLampa()",200);
		
}


function afiseaza_floater(){
		var divFloater=document.createElement("div");
		divFloater.setAttribute("id","lampa");
		divFloater.innerHTML="<div style='width:220px;'><div style='float:left;'><object id='FlashID' classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' width='180' height='300'><param name='movie' value='/flash/lampa.swf' /><param name='quality' value='high' /><param name='wmode' value='transparent' /><param name='swfversion' value='8.0.35.0' /><!-- This param tag prompts users with Flash Player 6.0 r65 and higher to download the latest version of Flash Player. Delete it if you don’t want users to see the prompt. --><param name='expressinstall' value='../Scripts/expressInstall.swf' /><!-- Next object tag is for non-IE browsers. So hide it from IE using IECC. --><!--[if !IE]>--><object type='application/x-shockwave-flash' data='/flash/lampa.swf' width='180' height='300'><!--<![endif]--><param name='quality' value='high' /><param name='wmode' value='transparent' /><param name='swfversion' value='8.0.35.0' /><param name='expressinstall' value='../Scripts/expressInstall.swf' /><!-- The browser displays the following alternative content for users with Flash Player 6.0 and older. --><div><h4>Content on this page requires a newer version of Adobe Flash Player.</h4><p><a href='http://www.adobe.com/go/getflashplayer'><img src='http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif' alt='Get Adobe Flash player' /></a></p></div><!--[if !IE]>--></object><!--<![endif]--></object></div><div style='float:left; padding-top:270px;'><a href='#' onclick='inchideLampa()'><img src='/images/close.gif' style='vertical-align:middle' /> </a></div></div>";
		/*<script language='JavaScript' type='text/javascript'>if ( MM_FlashCanPlay ){var f = new Flash ();f.setSWF ('/flash/lampa.swf', 180, 300);f.setParam ('quality', 'high');f.setParam ('menu', 'false');f.setParam ('wmode', 'transparent');f.display (); } </script>*/
		 var body=document.getElementById("fullContent").appendChild(divFloater);
		divFloater.style.position="absolute";
		
		setMarginLampa();
		
		//divFloater.style.left=950+left_space+"px";
		//divFloater.style.left="1400px";
		
		//setTimeout("afiseaza_floater()",200);
}
function readCookie(name) {
  var nameEQ = name + "=";
  var ca = document.cookie.split(';');
  for(var i=0;i < ca.length;i++) {
    var c = ca[i];
    while (c.charAt(0)==' ') c = c.substring(1,c.length);
    if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
  }
  return null;
}

window.onload = setUserOptions;


function setUserOptions(){
	
	if(!prefsLoaded){
		cookie = readCookie("fontSize");
		//alert(cookie);
		currentFontSize = cookie ? cookie : defaultFontSize;
		setFontSize(currentFontSize);
		prefsLoaded = true;
		
	}
	if(document.getElementById("tip1")!=null&&getCookie('subiect')!=null) ascunde_div_tip_client(getCookie('subiect'))

/* pentru afisare banner craciun in panel left */
/*
var container=document.getElementById("panelLeft");
var divFlash=document.createElement("div");

divFlash.id="flash_div";
var firstChild = document.getElementById("panelLeft").firstChild;
document.getElementById("panelLeft").insertBefore(divFlash, firstChild);
var so = new SWFObject('http://www.orange.ro/oferte-speciale/oferta-de-craciun/days/master-leftmenu.swf','jstest','150','140','8');
                  so.addParam('allowscriptaccess','always');
                  so.addParam('wmode','transparent');
                  so.addVariable('javascriptid','jstest');
                  so.addVariable('enablejs','true');
                  so.addVariable('autostart','true');
                  so.write('flash_div');
*/
//afiseaza_floater();

}


window.onunload = saveSettings;

function saveSettings()
{
  createCookie("fontSize", currentFontSize, 365);
}



function correctPNG() // correctly handle PNG transparency in Win IE 5.5 & 6.
{
   var arVersion = navigator.appVersion.split("MSIE")
   var version = parseFloat(arVersion[1])
   if ((version >= 5.5) && (document.body.filters)) 
   {
      for(var i=0; i<document.images.length; i++)
      {
         var img = document.images[i]
         var imgName = img.src.toUpperCase()
         if (imgName.substring(imgName.length-3, imgName.length) == "PNG")
         {
            var imgID = (img.id) ? "id='" + img.id + "' " : ""
            var imgClass = (img.className) ? "class='" + img.className + "' " : ""
            var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' "
            var imgStyle = "display:inline-block;" + img.style.cssText
            if (img.align == "left") imgStyle = "float:left;" + imgStyle
            if (img.align == "right") imgStyle = "float:right;" + imgStyle
			if (img.align == "middle") imgStyle = "margin-left:20px;" + imgStyle
            if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle
            var strNewHTML = "<span " + imgID + imgClass + imgTitle
            + " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";"
            + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
            + "(src=\'" + img.src + "\', sizingMethod='scale');\"></span>" 
            //alert(imgStyle);
			img.outerHTML = strNewHTML
            i = i-1
         }
      }
   }    
}

window.onload=correctPNG;
if (window.attachEvent)
window.attachEvent("onload", correctPNG)


function addLoadEvent(func) {
    var oldonload = window.onload;
    if (typeof window.onload != 'function') {
        window.onload = func;
    } else {
        window.onload = function() {
            if (oldonload) {
                oldonload();
            }
            func();
        }
    }
}
//addLoadEvent(correctPNG);



