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 closeBanner(){
	document.getElementById("lampa").style.display="none";
	createCookie("lampa","0",1);
	}

function inchideLampa(){
	//document.getElementById("lampa").style.display="none";
	document.getElementById("lampa").style.display="none";
	createCookie("lampa","0",1);
	
	}
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
		//alert(dsoctop);
		var _height=$(this).height();
		//alert(_height);
		
		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+970+"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=_height-300+$(this).scrollTop()+0+"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');
*/
//if(readCookie("lampa")!=0) 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);



function drona() {
	  
	  function doSomething() {
		var position = $('#fullContent').innerWidth();
		var left_space = (innerWidth - 950)/2;
		var left_space2 = (480 - left_space);
		if (left_space > 0) {
			$('.ardrone').css('left', -left_space2);
		}};
   
      var resizeTimer = null;
      $(window).bind('resize', function() {
		  
		
		  
      if (resizeTimer) clearTimeout(resizeTimer);
      resizeTimer = setTimeout(doSomething, 100);
      
		
});
}

function resizecss() { 


var deviceAgent = navigator.userAgent.toLowerCase();
 var agentID = deviceAgent.match(/(iphone|ipod|ipad)/);
 if (agentID) { 
	$("#size-stylesheet").attr("href", "style/main-mobile.css");
}

	
	function adjustStyle(width) {
		width = parseInt(width);
		if (width < 701) {
			$("#size-stylesheet").attr("href", "style/main-mobile.css");
		}  else {
		   $("#size-stylesheet").attr("href", "style/main.css");
		}
	}
	
	function adjustStyle(width) {
		width = parseInt(width);
		if (width < 701) {
			$("#size-stylesheet").attr("href", "style/main-mobile.css");
		} else if ((width >= 701) && (width < 900)) {
			$("#size-stylesheet").attr("href", "style/main.css");
		} else {
		   $("#size-stylesheet").attr("href", "style/main.css"); 
		}
	}
	
	
	$(function() {
		adjustStyle($(this).width());
		$(window).resize(function() {
			adjustStyle($(this).width());
		});
	});





}



function toppromo_myaccount() {
	
	$('#toppromo').fadeIn('slow', function() {
	
var text1= "administreaz&#259; mai multe  numere Orange dintr-un singur cont";
var texta1="intr&#259; &icirc;n contul t&#259;u Orange"
var text2= "re&icirc;ncarc&#259; un cont PrePay mult mai simplu";
var text3= "afl#259; toate avantajele  programului Orange Thank You";
var text4= "activezi tonuri de asteptare, ai acces rapid la serviciile tale Orange";
var text5= " pl&#259;te&#351;te factura online &#351;i activeaz&#259; listele de  convorbiri";
var text6= "afl&#259; oric&acirc;nd c&acirc;t ai consumat din beneficiile tale &#351;i c&acirc;t  mai ai disponibil";
var text7= "re&icirc;ncarci un cont PrePay mult mai simplu";
var text8= "activeaz&#259; serviciile Roaming &#351;i Apeluri  Interna&#355;ionale";
var text9= "redirec&#355;ioneaz&#259; apelurile &icirc;n  caz de urgen&#355;&#259; pe un alt num&#259;r de telefon";
var text= "po&#355;i s&#259; administrezi mai multe numere de telefon Orange dintr-un  singur cont";
var displaytext = text1 + '<br/><span class="stitle">' + texta1 +'</span>  ';
 
  if (selectedMainSection=="menu-produse") {
			var displaytext = text1 + '<br/><span class="stitle">' + texta1 +'</span>  ';
			if (selectedSubMenuSection=="ps-abovoce") {
				var displaytext = text5 + '<br/><span class="stitle">' + texta1 +'</span>  ';
			} 
			if (selectedSubMenuSection=="ps-abodate") {
				var displaytext = text6 + '<br/><span class="stitle">' + texta1 +'</span>  ';
			} 
			if (selectedSubMenuSection=="ps-ppy") {
				var displaytext = text7 + '<br/><span class="stitle">' + texta1 +'</span>  ';
			} 
			if (selectedSubMenuSection=="ps-travel") {
				var displaytext = text8 + '<br/><span class="stitle">' + texta1 +'</span>  ';
			} 
			 if (selectedSubMenuSection=="ps-orangecare") {
				var displaytext = text9 + '<br/><span class="stitle">' + texta1 +'</span>  ';
			} 
    } 
	
	 if (selectedMainSection=="menu-young") {
 	     var displaytext = text2 + '<br/><span class="stitle">' + texta1 +'</span>  ';
    } 
	 if (selectedMainSection=="menu-ow") {
    	 var displaytext = text4 + '<br/><span class="stitle">' + texta1 +'</span>  ';
    } 
	 if (selectedMainSection=="menu-oty") {
 	   var displaytext = text3 + '<br/><span class="stitle">' + texta1 +'</span>  ';
    } 
	
	var texttips = displaytext;
	
	$('#toppromo').fadeIn("slow");
	$('#toppromo').html('<div id="cmpromo"><a href="http://www.orange.ro/info-contul-meu/index.html" class="det"><span class="textbenef">' + texttips + '</span></a></div>');
	 }).delay(800).fadeIn(400);
 }
 
 function toppromo() {
	
	$('#toppromo').fadeIn('slow', function() {
	txt = "<p>Browser CodeName: " + navigator.appCodeName + "</p>";
	txt+= "<p>Browser Name: " + navigator.appName + "</p>";
	txt+= "<p>Browser Version: " + navigator.appVersion + "</p>";
	
	displaytext='Pentru a vizualiza optim informatiile din acest site, iti recomandam sa instalezi cea mai noua versiune <strong>Internet Explorer</strong> sau unul din celelalte browsere compatibile.';
	ie_text='<a href="http://windows.microsoft.com/ro-RO/internet-explorer/downloads/ie" target="_blank" class=""><img src="../images/browser/ie.jpg"/><span>Internet Explorer</span><br/>&raquo; instaleaza</a>';
	ff_text='<a href="http://www.mozilla.org/ro/firefox/new/" target="_blank" class=""><img src="../images/browser/ff.jpg"/><span>Firefox</span><br/>&raquo; instaleaza</a>';
	chrome_text='<a href="http://www.google.com/chrome?hl=ro" target="_blank" class=""><img src="../images/browser/chrome.jpg"/><span>Chrome</span><br/>&raquo; instaleaza</a>';
	opera_text='<a href="http://www.opera.com/download/" target="_blank" class=""><img src="../images/browser/opera.jpg"/><span>Opera</span><br/>&raquo; instaleaza</a>';
	safari_text='<a href="http://www.apple.com/safari/download/" target="_blank" class=""><img src="../images/browser/safari.jpg"/><span>Safari</span><br/>&raquo; instaleaza</a>';

	var texttips = displaytext;
	
	if (navigator.appVersion.indexOf('MSIE 6')!=-1) {


	
	$('#toppromo').fadeIn("slow");
	$('#toppromo').html('<div id="cmpromo">'+displaytext+ie_text+ff_text+chrome_text+opera_text+safari_text+'</div>');
	}
	
	 }).delay(800).fadeIn(400);
 }


function deccr() {
	$('#toppromo').html('<div id="santa"> </div>');	
 }

