// JavaScript Document
function initcufon() {
  Cufon.replace('#navWrpr .mItems a', { hover:true, hoverables: { a:true } });
  Cufon.replace('h2');
  Cufon.replace('h3');
  Cufon.replace('h4');
  Cufon.replace('h5');
  Cufon.replace('a.bullRight', { hover:true, hoverables: { a:true } });
  Cufon.replace('#sWrpi h2');
  Cufon.replace('#sWrpi p');
}

function sfHover() {

  var sfEls = $("#navbar li");
  if (sfEls.length >0) {
		$("#navbar li").mouseover(function(){
          $(this).addClass('hover');
        }).mouseout(function(){
          setTimeout($(this).removeClass('hover'),1000);  
        });
  }
}
var sWrpiinpTxt;
var cWrpichRightinp;
var fWrpifCenterinp;

$(document).ready(function() {
if($('#cpWrpi').length > 0) {
  $('#cWrpr').removeClass("nwsBG");
}

if($('#ccWrpi').length > 0) {
  $('#cWrpr').removeClass("nwsBG");
}
if($('#divQuota').length > 0){
    var quoteH = $('#nwsWrprNoJFlow .nwsItem .top .topi .quote').height();
    var divQuotaH = $('#divQuota').height();
    if($('#divQuota').width() >= 625){
        $('#divQuota').width(594);
    }
    if($('#divQuota').width() < 594){
        $('#divQuota').width(594);
    }
    $('#divQuota').css("margin-top", ((quoteH-divQuotaH)/2));
}
/*maximize the height of google-map*/
if($('.ccWrpiCnt').length > 0) {
    var nWrprH = $('#nWrpr').height();
    var fWrprH = $('#fWrpr').height();
    var ccWrpiCntH = $('.ccWrpiCnt').height()+20;
    var iframemapH = $('#iframemap').height();
    if($('#iframemap').length > 0) {
      $('#cWrpr').removeClass("nwsBG");
      $('#iframemap').height($(window).height()-nWrprH-fWrprH-ccWrpiCntH);
    }
    
}
/*subMenuPrepare*/													 
	$('#navWrpr .mItems ul li.sub ul').hide();
/*Copyright year update*/
  var today=new Date();
	$('#trcDate').html(today.getFullYear());
/*inpActivate*/	
  if (typeof $('#searchWrpr .inpTxt') != 'undefined') {
    var tmp1 = $('#searchWrpr .inpTxt').attr('value');
    $('#searchWrpr .inpTxt').focus(function(){
      if ($(this).attr('value') == '' || $(this).attr('value') == tmp1 ) { 
		    $(this).attr('value','');
			}
		});
		$('#searchWrpr .inpTxt').blur(function(){
      if ($(this).attr('value') == '' || $(this).attr('value') == tmp1 ) { 
			  $(this).attr('value', tmp1);
			}
    });
	}
	if (typeof $('#fWrpi .fCenter .inp') != 'undefined') {
		var tmp2 = $('#fWrpi .fCenter .inp').attr('value');
    $('#fWrpi .fCenter .inp').focus(function(){
      if ($(this).attr('value') == '' || $(this).attr('value') == tmp2 ) { 
		    $(this).attr('value','');
			}
		});
		$('#fWrpi .fCenter .inp').blur(function(){
      if ($(this).attr('value') == '' || $(this).attr('value') == tmp2 ) { 
			  $(this).attr('value', tmp2);
			}
    });
	}
	if (typeof $('#ccWrpi .chRight .inp') != 'undefined') {
		var tmp3 = $('#ccWrpi .chRight .inp').attr('value');
    $('#ccWrpi .chRight .inp').focus(function(){
      if ($(this).attr('value') == '' || $(this).attr('value') == tmp3 ) { 
		    $(this).attr('value','');
			}
		});
		$('#ccWrpi .chRight .inp').blur(function(){
      if ($(this).attr('value') == '' || $(this).attr('value') == tmp3 ) { 
			  $(this).attr('value', tmp3);
			}
    });
	}
/*subMenuActivate*/	
	$('#navWrpr .mItems ul li.sub').mouseover(function(){
	  $('#navWrpr .mItems ul li.sub ul').show();
  });
	$('#cWrpr, #navWrpr .logo, #searchWrpr').mouseover(function(){
	  $('#navWrpr .mItems ul li.sub ul').hide();
  });
  $('#navWrpr .mItems').click(function(){
	  $('#navWrpr .mItems ul li.sub ul').hide();
  });
  $(".km").mouseover(function(){
	  $('#navWrpr .mItems ul li.sub ul').hide();
  });
  $(".hideSub").mouseover(function(){
	  $('#navWrpr .mItems ul li.sub ul').hide();
  });
/*jFlow-Project*/	
	$("#cpWrpi .pageIndex.big").jFlow({
        slides: "#crvScrn",
		controller: ".jfc",
        slideWrapper : "#test",
        selectedWrapper: "jFlowSelected",
		auto: true,
        width: "652px",
        height: "436px",
        duration: 400,
		prev: ".prev",
        next: ".next"
    });
/*jFlow-News/Partners/Jobs*/
  $('#nwsWrpr .nwsItem .bottom.two').hide();
  $('#nwsWrpr .nwsItem .bottom .link').click(function() {
	  $(this).parent().parent().parent().siblings().children('.two').show(200);
		$(this).parent().parent('div').hide();
  });
  var maxH = 0;
  var winH = $(window).height();
  var avaH = $(window).height()-435;
  if($('#nwsWrprNoJFlow .nwsItem .bottom').height() > maxH) {
          maxH = $('#nwsWrprNoJFlow .nwsItem .bottom').height();
      }
   if (maxH < avaH) {
        maxH = avaH;
      }
   if (maxH < $('#nwsMenuNoJFlow').height()){
        maxH = $('#nwsMenuNoJFlow').height();
   }
    $('#nwsWrprNoJFlow .nwsItem .bottom').height(maxH);
//    $('#nwsWrpr .nwsItem .bottom').each(function() {
//      if($(this).height() > maxH) {
//          maxH = $(this).height();
//      }
//   });       
//   if (maxH < ($(window).height()-397)) {
//        maxH = ($(window).height()-397);
//      }
//    $('#nwsWrpr .nwsItem .bottom').each(function() {
 //    $(this).height(maxH);
//    });
//    $('#nwsMenu').height(maxH);
    
    $("#nwsMenu .newsControll ul li").jFlow({
      slides: "#nwsWrpr",
      controller: ".jfc", 
      slideWrapper : "#jFlowSlide",
      selectedWrapper: "act",
      width: "100%",
      height: "auto",
      duration: 400,
      prev: ".lnav",
      next: ".rnav"
    });

 $('#nwsMenu .newsControll ul li a').click(function() {
  $('#nwsWrpr .nwsItem .bottom').show();
	$('#nwsWrpr .nwsItem .bottom.two').hide();																								
  });
 $('#cWrpr .pageIndex a').click(function() {
  $('#nwsWrpr .nwsItem .bottom').show();
	$('#nwsWrpr .nwsItem .bottom.two').hide();																								
  });
/* *** Flash Width *** */
    var tmpfWitdh = "width "+$(window).width()+"px";
		$('#cWrpr .pplFlash p').html(tmpfWitdh);
/*cufonActivate*/
initcufon();
    $('#cboxOverlay').height($(document).height());

/* Privacy Statement */		
  if ($(".Privacy").length > 0) {
  $(".Privacy").colorbox({ inline:true, href:"#Privacy"});
	}
});


