function alertWidth() {
  var myWidth = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myWidth = window.innerWidth;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    myWidth = document.documentElement.clientWidth;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    myWidth = document.body.clientWidth;
  }
  return myWidth;
} 
function alertHeight() {
  var myHeight = 0;
  if( typeof( window.innerHeight ) == 'number' ) {
    //Non-IE
    myHeight = window.innerHeight;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    myHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    myHeight = document.body.clientHeight;
  }
  return myHeight-150;
}

$(document).ready(function(){
$('#print').parent('a').click(function(){
  		window.print();
  		return false;
  		}
  	);
jQuery("#nav ul.main li").hover(
      function () {
        jQuery(this).find("ul").show("fast");
      }, 
      function () {
        jQuery(this).find("ul").hide("fast");
      }
  );
$("li.profile").hover(
  function () {
   var myWidth = 0, myHeight = 0;
   var offset = $('img', this).offset();
   if(offset > alertWidth(myWidth)) {
     $(this).css('z-index', 99999);
     $('div.v-card-main', this).show();
   } else if(offset.left >780 && offset.left <1100){
    $(this).css('z-index', 99999);
    $('div.v-card-main', this).css('right',0).show();
   } else {
    $(this).css('z-index', 99999);
    $('div.v-card-main', this).show();
   }
   if(offset.top > alertHeight(myHeight) || offset.top > 800){
    $(this).css('z-index', 99999);
    $('div.v-card-main', this).css('top',-80).show();
   }
  },
  function () {
    $('div.v-card-main', this).fadeOut(500);
    $(this).css('z-index', 1);
  }  
);
  
  
  $("span.phone-label").each(function(){
   var el = $(this);
   var child = el.find("span.phone");
   
   if (!child[0] || child.html() == "&nbsp;" || child.html() == " " || child.html() == "") {
       el.hide();
   }
  });
  
$('li.profile:eq(3)').after('<li class="profile"><img src="/fileadmin/templates/images/pho11.gif" /></li>');
$('li.profile:eq(8)').after('<li class="profile"><img src="/fileadmin/templates/images/pho28.gif" /></li>');
$('li.profile:eq(14)').after('<li class="profile"><img src="/fileadmin/templates/images/pho28.gif" /></li>');
$('li.profile:eq(17)').after('<li class="profile"><img src="/fileadmin/templates/images/pho21.gif" /></li>');
$('li.profile:eq(20)').after('<li class="profile"><img src="/fileadmin/templates/images/pho34.gif" /></li>'); 
$('li.profile:eq(25)').after('<li class="profile"><img src="/fileadmin/templates/images/pho21.gif" /></li>');
$('li.profile:eq(31)').after('<li class="profile"><img src="/fileadmin/templates/images/pho21.gif" /></li>');

  // Reset Font Size
  var originalFontSize = $('html').css('font-size');
    $("#resetFont").click(function(){
    $('.mid').css('font-size', originalFontSize);
  });
  // Increase Font Size
  $("#plus").click(function(){
    var currentFontSize = $('html').css('font-size');
    var currentFontSizeNum = parseFloat(currentFontSize, 10);
    var newFontSize = currentFontSizeNum*1.2;
    $('.mid').css('font-size', newFontSize);
    return false;
  });
  // Decrease Font Size
  $("#minus").click(function(){
    var currentFontSize = $('html').css('font-size');
    var currentFontSizeNum = parseFloat(currentFontSize, 10);
    var newFontSize = currentFontSizeNum*0.8;
    $('.mid').css('font-size', newFontSize);
    return false;
  });

$('#emailthis').wrap('<a href="/tipafriend.html?tipUrl=http%3A%2F%2F' + window.location.hostname + encodeURIComponent(location.pathname) + '">');


	if ( $('#main-home')[0] ) {
		var num = Math.floor(Math.random()*4);
		$('#main-home').css("background", "url(/fileadmin/templates/images/Photo" + num + ".jpg) no-repeat") ;  
	}
	
});
function goToByScroll(id){
     	$('html,body').animate({scrollTop: $("#"+id).offset().top},'slow');
}

