var $j = jQuery.noConflict();


$j(document).ready(function()
{

  if(getCookie('show_message')!='no')
  {
      var pos=parseInt($j(window).scrollTop())+parseInt($j(window).height());
      $j('#message_box').css("top",pos-26+"px");
      $j('#message_box').show(); //display the message box
	  
	  document.getElementById("message_box").style.opacity = "0.5";
	  document.getElementById("message_box").style.filter = "alpha(opacity=50)";
	
      //scroll the message box to the top offset of browser's scrool bar
	  $j(window).scroll(function()
	  {
  	     var pos=parseInt($j(window).scrollTop())+parseInt($j(window).height());
        $j('#message_box').animate({top:pos-26+"px" },{queue: false, duration: 500});  
	  });
    }
   //when the close button at right corner of the message box is clicked 
	$j('#close_message').click(function()
	{
  		//the messagebox gets scrool down with top property and gets hidden with zero opacity 
		$j('#message_box').animate({ top:"-=15px",opacity:0 }, "slow");
        setCookie('show_message','no',1); //cookies is set to no value
	});
});

//function to set the cookie name, values and expiry time in hours 
function setCookie(c_name,value,expireHours)
{
  var exhour=new Date(); //create the current date object
  exhour.setHours(exhour.getHours()+0); //default 1
  document.cookie=c_name+ "=" +escape(value)+
  ((expireHours==null) ? "" : ";expires="+exhour.toGMTString());
}

//function to get the value from cookie name
function getCookie(c_name)
{
  if (document.cookie.length>0)
  {
    c_start=document.cookie.indexOf(c_name + "=");
    if (c_start!=-1)
    { 
      c_start=c_start + c_name.length+1; 
      c_end=document.cookie.indexOf(";",c_start);
      if (c_end==-1) c_end=document.cookie.length;
        return unescape(document.cookie.substring(c_start,c_end));
    } 
  }
  return "";
}	
	
	
	
	
	

function changeClass()
{
	
	if (document.getElementById("Entire_Features") )
	{
		document.getElementById("Entire_Features").setAttribute("id", "Entire_Features_Full");
		document.getElementById("expandICON").setAttribute("id", "closeICON");
		
		
		
	}
	else
	{
		document.getElementById("Entire_Features_Full").setAttribute("id", "Entire_Features");
		document.getElementById("closeICON").setAttribute("id", "expandICON");
	}
}

function changeTranslate()
{
	
	if (document.getElementById("myTranslator_Off") )
	{
		document.getElementById("myTranslator_Off").setAttribute("id", "myTranslator_On");
		TB_position();
		document.getElementById("fade").style.background = "#000";
		document.getElementById("fade").style.opacity = "0.4";
		/* document.getElementById("fade").style.-moz-opacity = "0.4"; */
		document.getElementById("fade").style.filter = "alpha(opacity=40)";
	}
	else
	{
		document.getElementById("myTranslator_On").setAttribute("id", "myTranslator_Off");
	}
}

var TB_NextObjToShow, TB_NextDirection, TB_WIDTH = 0, TB_HEIGHT = 0, TB_VisibleSelects, TB_WasOpen;


function TB_position() {
	var pagesize = getPageSize();
  
  	if (window.innerHeight && window.scrollMaxY) {	
		yScroll = window.innerHeight + window.scrollMaxY;
	} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
		yScroll = document.body.scrollHeight;
	} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
		yScroll = document.body.offsetHeight;
  	}
	
	var arrayPageScroll = getPageScrollTop();
	
	//$j("#myTranslator_On").css({width:TB_WIDTH+"px",height:TB_HEIGHT+"px",
	$j({left: ((pagesize[0] - TB_WIDTH)/2)+"px", top: (arrayPageScroll[1] + ((pagesize[1]-TB_HEIGHT)/2))+"px" });
	$j("#fade").css("height",yScroll +"px");
}

function getPageSize(){
	var de = document.documentElement;
	var w = window.innerWidth || self.innerWidth || (de&&de.clientWidth) || document.body.clientWidth;
	var h = window.innerHeight || self.innerHeight || (de&&de.clientHeight) || document.body.clientHeight;
	
	arrayPageSize = new Array(w,h) 
	return arrayPageSize;
}

function getPageScrollTop(){
	var yScrolltop;
	if (self.pageYOffset) {
		yScrolltop = self.pageYOffset;
	} else if (document.documentElement && document.documentElement.scrollTop){	 // Explorer 6 Strict
		yScrolltop = document.documentElement.scrollTop;
	} else if (document.body) {// all other Explorers
		yScrolltop = document.body.scrollTop;
	}
	arrayPageScroll = new Array('',yScrolltop) 
	return arrayPageScroll;
}


