/**
 * Javascripts for LU Prince 
 * 
 */

  var lu = {};




/**
 * Timeline
 * 
 */
  
  lu.timeline = {};
  lu.timeline.speed = 800;
  lu.timeline.moveWidth = 300;
  lu.timeline.maskWidth = 735;
  
  lu.timeline.init = function() {
    
    // get objects
    lu.timeline.ul = $('.timeline ul');
    lu.timeline.lis = lu.timeline.ul.children('li');
    lu.timeline.leftEl = $('.timeline .left');
    lu.timeline.rightEl = $('.timeline .right');
    
    // resize list
    lu.timeline.ulw = lu.timeline.lis.length * parseFloat(lu.timeline.lis.css('width'));
    lu.timeline.ul.css('width', lu.timeline.ulw);
    
    // add actions
    lu.timeline.leftEl.click(function() { lu.timeline.left(); return false; }).hide();
    lu.timeline.rightEl.click(function() { lu.timeline.right(); return false; });
    
    // hover effect
    lu.timeline.lis.children('a').hover(function() {
      $(this).children('div').children('img').animate({ 'margin-top': 10 }, 300);
    }, function() {
      $(this).children('div').children('img').animate({ 'margin-top': 0 }, 300);
    });
    
  };
  
  lu.timeline.move = function(dir) {
    
    // check direction
    if(typeof(dir) == 'undefined') dir = 1;
    var left = parseFloat(lu.timeline.ul.css('margin-left')) - (lu.timeline.moveWidth * dir);
    
    // show hide arrows
    lu.timeline.leftEl.show();
    lu.timeline.rightEl.show();
    if(left > 0) { left = 0; lu.timeline.leftEl.hide(); }
    if(left < -(lu.timeline.ulw - lu.timeline.maskWidth)) { left = -(lu.timeline.ulw - lu.timeline.maskWidth); lu.timeline.rightEl.hide(); }
    
    // move it
    lu.timeline.ul.animate({ 'margin-left': left }, lu.timeline.speed);
    
  };
  
  lu.timeline.right = function() { lu.timeline.move(1); };
  lu.timeline.left = function() { lu.timeline.move(-1); };




/**
 * Document ready
 * 
 */

  $(document).ready(function() {
    
	if($.browser.msie && $.browser.version <= 6){
		DD_belatedPNG.fix('.png_bg');
	}
	
    lu.timeline.init();
    
    if($.browser.msie) $('.overlayer_form .overlayer_bg, .overlayer_where .overlayer_bg, .overlayer_bg_fillme').html('<img src="/images/general/overlayer_bg.gif" alt="" />');
    else $('.overlayer_where .overlayer_bg, .overlayer_bg_fillme').html('<img src="/images/general/overlayer_bg.png" alt="" />');
    
    $('.open_overlayer_where').click(function() { $('.overlayer_where').show(); return false; });
    $('.overlayer_close').click(function() { $('.overlayer_where, .modalPopupLarge, .modalBackground').hide(); return false; });
    
    if($.browser.msie && parseInt($.browser.version, 10) == 7) {
    	var top = parseFloat($('.contentContainer').css('height')) + 10;
    	$('.footer').css({ 'top': top });
    }
    
  });



