$(document).ready(function(){
						   
   
   
   //last items
   $('.sc_cart .code_col:last, .sc_cart .desc_col:last, .sc_cart .price_col:last, .sc_cart .qty_col:last, .sc_cart .total_col:last, .sc_cart .actions_col:last').css({'display' :  'none'});
   
   //Press	
  var js2 = "return loadIframe('htmlFrame', this.href)";
  $('.presscenterpt .ContentInner').append('<div id="Contentpresslogin">Para aceder &#224;s fotos &#233; necess&#225;rio efectuar o login. Se pertence &#224; imprensa e n&atilde;o possui login envie-me de um mail do meio autorizado.<\/div><div id="Presslogin"><a href="http://gallery.me.com/bernardosousa"  onclick="'+js2+'"><img src="/bs/templates/BernardoSousa/images/iconpressFotos_pt.gif" alt="press" /><\/a><\/div><div style="clear:both;"></div>');
    var js2 = "return loadIframe('htmlFrame', this.href)";
  $('.presscenteren .ContentInner').append('<div id="Contentpresslogin">To access the photo area its required a log in. If you belong to credited press and dont have a login, email me.<\/div><div id="Presslogin"><a href="http://gallery.me.com/bernardosousa"  onclick="'+js2+'"><img src="/bs/templates/BernardoSousa/images/iconpressFotos_en.gif" alt="press" /><\/a><\/div><div style="clear:both;"><\/div>');
  


  //alert(htmlgraphic);
  if ($('#slideshowbox').length > 0) {
      $('#Graphic').css({'background-color' : '#FFFFFF'});
  }else {
      $('#Graphic').html('<img src="http://bernardo-sousa.com/bs/images/slideshow/aboutbs/bs201.jpg" alt="" border="0"/>');

  }

  $("#Logo img").pngfix();
  //$("div, td").pngfix({sizingMethod: "scale"});
						   

  $(".TableRallyes tr:nth-child(odd)").addClass("gray");
  $(".TableRallyes tr:nth-child(1)").addClass('firstblack');
  $(".TableRallyes tr:nth-child(2)").addClass('secondred');
  $('.TableRallyes tr:visible td:nth-child(1)').addClass('fristtd');
  $('.TableRallyes tr:visible td:nth-child(2)').addClass('secondtd');
  $('.TableRallyes tr:visible td:nth-child(5)').addClass('lasttd');
  $('.TableRallyes tr:last').addClass('lastchlid');
  $('tr.secondred td, tr.firstblack td, tr.lastchlid td').removeClass('fristtd');
  $('tr.secondred td').removeClass('lasttd');
  
  
  $('.IntroRallyes tr:nth-child(2)').addClass('cellyear');
  $('#usemap img').attr('usemap', '#Map2');
  
  $('.TableRent tr:nth-child(3)').addClass('cellred');
  
  $('.article_column p:nth-child(3), #page p:nth-child(3),').addClass('clear');
  
  
  $('.blog').append('<div class="clear"></div>');
  
  
  $('.acymailing_form').attr('align', 'center');
  $('.acymailing_form tr:last').addClass('lastitem');
  
  textbuttonletter = $('.acymailing_form .button').attr('value');
  if(textbuttonletter=='Subscrever') {
    $('.acymailing_form .button').attr('value', ' ').css({'border' : 'none'});
	$('.acymailing_form .button').addClass('buttonpt');
  } else {
	$('.acymailing_form .button').attr('value', ' ').css({'border' : 'none'});
	$('.acymailing_form .button').removeClass('buttonen');
  	$('.acymailing_form .button').addClass('buttonen');
  }
  $('.acymailing_form .inputbox').parent().addClass('Cellinput');
  $('.acymailing_form label').parent().addClass('Celllabel');

  
  $('.acymailing_form .lastitem td').css({'display' : 'block'});
    
  
  
  $("#jflanguageselection ul li img").each(function (index) { 
    textflag = $(this).attr('alt');
	if(textflag=='English (United Kingdom)') {
	  $(this).attr("src","/bs/templates/BernardoSousa/images/en.png");
	}else {
	 $(this).attr("src","/bs/templates/BernardoSousa/images/pt.png");
	}
  });
  
  
  if($('#page img').css('float') =='left'){
	$('#page img').after('<p><br/></p>');

    $('#page img').css({'float' : 'none'});
  }
  
  $('#RES_ID_fb_login_image').attr('src', '/bs/templates/BernardoSousa/images/Facebook.png');


});


 function loadIframe(iframeName, url) {
       if ( window.frames[iframeName] ) {
        window.frames[iframeName].location = url;   
        return false;
       }
       return true;
     }
	 

	 $(document).ready(function(){


	   $("#MenuSociais a").each(function (index) { 
           var js = "return loadIframe('htmlFrame', this.href)";
           imgmenus=$(this).html();

           if(index == 0){
            $(this).parent().html('<a href="'+this.href+'">'+ imgmenus +'</a>');
           }else {
            $(this).parent().html('<a href="'+this.href+'" onclick="'+js+'">'+ imgmenus +'</a>');
           }
         //var newclick = eval("(function(){"+js+"});");
         //$(this).attr('onclick', '').click(newclick);
	   });
	   
	   $("#MenuSponsors a").each(function () { 
           var js2 = "return loadIframe('htmlFrame', this.href)";
           imgmenus2=$(this).html();
            $(this).parent().html('<a href="'+this.href+'" onclick="'+js2+'">'+ imgmenus2 +'</a>');
	   });

       $('#MenuSociais a, #MenuSponsors a').addClass('ext');
	   $('#MenuSociais a:first').removeClass('ext');

       $("#MenuSociais a.ext, #MenuSponsors a.ext, #Blog a, #Presslogin a").click(function () { 
																			
        $('#ContentIframe').css({'display':'block'});
        $('#AllContent').css({'display':'none'});
	    $('#Menuidiomas').css({'display':'none'});
	    $('#flag').css({'display':'none'});


          if($('#ContentIframe').css('display')=='block'){
           $('#MenuSponsors').css({'right':'15px'});
          }
       });
       
	   parentcorner = $('#MenuHorizontal .menu li.item65 ul').html();
       $('#MenuHorizontal .menu li.item65 ul').css({'display' : 'none'});
	   $('#MenuHorizontal .menu li.item65').append('<ul class="ulcorner" id="item65"><li class="CornerTop"><\/li>'+parentcorner+'<li class="CornerBottom"><\/li><\/ul>');
	   
	   parentcorner = $('#MenuHorizontal .menu li.item66 ul').html();
       $('#MenuHorizontal .menu li.item66 ul').css({'display' : 'none'});
	   $('#MenuHorizontal .menu li.item66').append('<ul class="ulcorner" id="item66"><li class="CornerTop"><\/li>'+parentcorner+'<li class="CornerBottom"><\/li><\/ul>');
	   
	   
	   parentcorner = $('#MenuHorizontal .menu li.item67 ul').html();
       $('#MenuHorizontal .menu li.item67 ul').css({'display' : 'none'});
	   $('#MenuHorizontal .menu li.item67').append('<ul class="ulcorner" id="item67"><li class="CornerTop"><\/li>'+parentcorner+'<li class="CornerBottom"><\/li><\/ul>');
	   
	   parentcorner = $('#MenuHorizontal .menu li.item69 ul').html();
       $('#MenuHorizontal .menu li.item69 ul').css({'display' : 'none'});
	   $('#MenuHorizontal .menu li.item69').append('<ul class="ulcorner" id="item69"><li class="CornerTop"><\/li>'+parentcorner+'<li class="CornerBottom"><\/li><\/ul>');
	   
	   $("#MenuHorizontal .menu li.item65").hover(function(){
         $('ul#item65').show();
           },function(){
         $('ul#item65').hide();
       });
	   
       $("#MenuHorizontal .menu li.item67").hover(function(){
         $('ul#item67').show();
           },function(){
         $('ul#item67').hide();
       });
	   
       $("#MenuHorizontal .menu li.item66").hover(function(){
         $('ul#item66').show();
           },function(){
         $('ul#item66').hide()
       });
	   $("#MenuHorizontal .menu li.item69").hover(function(){
         $('ul#item69').show();
           },function(){
         $('ul#item69').hide()
       });
	   
	    $("ul#item66").mouseleave(function() {
		  $(this).hide();						
		});
	    $("ul#item67").mouseleave(function() {
		  $(this).hide();						
		});
	    $("ul#item65").mouseleave(function() {
		  $(this).hide();						
		});
	    $("ul#item69").mouseleave(function() {
		  $(this).hide();						
		});
		
		
      });
