(function($){
 $.fn.extend({ 
 	 customStyle : function(options) {
	  if(!$.browser.msie || ($.browser.msie)){
	  return this.each(function() {
	  
			var currentSelected = $(this).find(':selected');
			$(this).after('<span class="customStyleSelectBox"><span class="customStyleSelectBoxInner">'+currentSelected.text()+'</span></span>').css({position:'absolute',opacity:0,fontSize:$(this).next().css('font-size')});
			var selectBoxSpan = $(this).next();
			var selectBoxWidth = parseInt($(this).width()) - parseInt(selectBoxSpan.css('padding-left')) -parseInt(selectBoxSpan.css('padding-right'));
			var selectBoxSpanInner = selectBoxSpan.find(':first-child');
			selectBoxSpan.css({display:'inline-block'});
			selectBoxSpanInner.css({width:selectBoxWidth, display:'inline-block'});
			var selectBoxHeight = parseInt(selectBoxSpan.height()) + parseInt(selectBoxSpan.css('padding-top')) + parseInt(selectBoxSpan.css('padding-bottom'));
			$(this).height(selectBoxHeight).change(function(){
				//selectBoxSpanInner.text($(this).val()).parent().addClass('changed');
				  selectBoxSpanInner.text($('option:selected',this).text()).parent().addClass('changed');
			});
			
	  });
	  }
	}
 });
})(jQuery);

$(function(){
$('select.styled').customStyle();
});


function SetCookie(cookieName,cookieValue,nDays) {
 var today = new Date();
 var expire = new Date();
 if (nDays==null || nDays==0)
 {
	 nDays=1;
 }
 expire.setTime(today.getTime() + 3600000*24*nDays);
 document.cookie = cookieName+"="+escape(cookieValue)+ ";expires="+expire.toGMTString();
}

function GetCookie (cookie_name)
{
  var results = document.cookie.match ( '(^|;) ?' + cookie_name + '=([^;]*)(;|$)' );

  if ( results )
    return ( unescape ( results[2] ) );
  else
    return null;
}


function hidefloatingmenu()
{
 $('#mainpanel').hide('slow');$('#openmenu').show('slow');
 SetCookie ("menu","closemenu",1000);
}
function showfloatingmenu()
{
$('#mainpanel').show('slow');$('#openmenu').hide('slow');
 SetCookie ("menu","openmenu",1000);
}
