
function initScrollHistory()
{$(window).scroll(function()
{var this_scroll=$(window).scrollTop();$.cookie('ghacker_pagesNscrolls',this_scroll,{'path':'/'});});};var first_scroll=false;var first_scroll_top=0;function getLastScrollPosition()
{var last_scroll=$.cookie('ghacker_pagesNscrolls');first_scroll=true;first_scroll_top=last_scroll;window.scrollTo(0,last_scroll);};var addthis_config={ui_click:true,services_compact:'twitter,facebook,tumblr,stumbleupon,favorites,more'};function initSelectiveScroll()
{var detail_panel_h=$('.detail_panel').height();var offset_for_header_n_footer=154;$(window).scroll(function()
{detail_panel_h=$('.detail_panel').height();if(pageDetailBtmReached())
{if(detail_panel_h<=$(window).height()-offset_for_header_n_footer){$('.detail_panel').addClass('detail_panel_fix_to_top');}
else{$('.detail_panel').addClass('detail_panel_fix_to_btm');}}
else
{$('.detail_panel').removeClass('detail_panel_fix_to_top').removeClass('detail_panel_fix_to_btm');}});function pageDetailBtmReached()
{var scroll_pos=($(window).height()-offset_for_header_n_footer)+$(window).scrollTop();if(scroll_pos>=detail_panel_h||detail_panel_h<=$(window).height()-offset_for_header_n_footer){return true;}
else{return false;}};};function initColumnizer()
{$('.landscape .page_detail_text').columnize({width:436,lastNeverTallest:true});};function initLazyLoad()
{$("img").lazyload({placeholder:"_images/transparent_white.png",effect:"fadeIn"});};function initPageSearch()
{$('#search_txtbox').keypress(function(event){if(event.keyCode=='13'){searchPage();}});$('#search_btn').click(function(){searchPage();});};function searchPage()
{var found=false;var img_divs=$('.img_with_caption').each(function()
{$(this).removeClass('search_found');var term=$('#search_txtbox').attr('value').toLowerCase();var img_alt=$(this).find('img').attr('alt').toLowerCase();var caption=$(this).find('.boxcaption').text().toLowerCase();if(img_alt.indexOf(term)!=-1||caption.indexOf(term)!=-1)
{found=true;$(this).addClass('search_found');}});if(found)
{var first_elm_pos=$('.search_found:first').offset();$(window).scrollTo({top:first_elm_pos.top-108,left:0},800);}
else
{$('#search_txtbox').attr('value','Not found');}};function initImgCaptions()
{$("div.img_with_caption").each(function()
{var img_w=$(this).find('img').width()+2;$(this).find('div.boxcaption').css({'width':img_w,'max-width':img_w});});var config={sensitivity:3,interval:200,over:openCaption,timeout:500,out:closeCaption};function openCaption()
{if($('div.boxcaption',this).length>0)
{var cap_h=$('div.boxcaption',this).height();var cap_pad_top=$('div.boxcaption',this).css('padding-top');var cap_pad_top_nr=cap_pad_top.substr(0,cap_pad_top.indexOf('px'));var cap_pad_btm=$('div.boxcaption',this).css('padding-bottom');var cap_pad_btm_nr=cap_pad_btm.substr(0,cap_pad_btm.indexOf('px'));var cap_open_pos=154-(Number(cap_h)+Number(cap_pad_top_nr)+Number(cap_pad_btm_nr))+1;$('div.boxcaption',this).stop().animate({top:cap_open_pos+'px'},{queue:false,duration:160})}};function closeCaption(){$('div.boxcaption',this).stop().animate({top:'155px'},{queue:false,duration:160})};$('.img_with_caption').hoverIntent(config);};function initNavigation()
{var config={sensitivity:3,interval:200,over:openMenu,timeout:200,out:closeMenu};function openMenu()
{var frm=$(this).find('div.submenu_frm');var ul=$(this).find('ul.submenu');if($(frm).attr('rel')==''){$(frm).attr('rel',$(ul).width());}
var menu_w=$(frm).attr('rel');$(ul).css({'display':'block','top':0});var win_h=$(window).height();frm.css({'display':'block','position':'absolute','width':(menu_w+'px'),'height':((win_h-138)+'px')});$('.submenu_frm').mousemove(function(e)
{var frm_h=$(this).height();var menu_h=$('ul',this).height();if(menu_h>frm_h)
{var diff=menu_h-frm_h;var diff_1perc=diff/100;var frm_h_1perc=frm_h/100;var mouse_y=e.pageY-99;var menu_y=(mouse_y/frm_h_1perc)*diff_1perc;$(this).find('ul').css('top',-menu_y);}});}
function closeMenu(){$('ul',this).css('display','none');$(this).find('div.submenu_frm').css('display','none');}
$('#menu li.submenu_wrapper').hoverIntent(config);var config_client_highlight={sensitivity:3,interval:200,over:clientOver,timeout:500,out:function(){}};function clientOver()
{var btn_title=$(this).html();$('#page_section img').each(function()
{if($(this).attr('alt')==btn_title){$(this).addClass('selected_image');}
else{$(this).removeClass('selected_image');}});};$('ul.submenu li a').hoverIntent(config_client_highlight);$('ul.submenu li a').hover(function(){$('#page_section img').each(function(){$(this).removeClass('selected_image');});});};function resetNavBtnsAndImgs(cur_active_btn_id)
{if($(this).attr('id')!="clientlist_btn"){$("#clientlist").animate({height:'hide'});}
$('#navigation li').each(function()
{if($(this).attr('id')!=cur_active_btn_id)
{$(this).removeClass('navigation_selected');}});$('#page_section img').each(function(){$(this).removeClass('selected_image');});};var clientlist_is_open=false;var menu_is_open=false;var lis=new Array();var cur_lis_inx=0;function initNewsSlides()
{$('#news_ticker').click(function()
{window.location.href="index.php?page=News&h=_Home";});if($('#news_ticker').length>0)
{var top_img_w=0;$('#top_imgs_row img').each(function()
{top_img_w+=$(this).attr('width')+18;});var nt_w=1024-(top_img_w+9);$('#news_ticker').css('width',nt_w+'px');$.ajax({url:"_php/__frontend/_home/get_blog_imgs.php",success:function(data)
{var ul=$(data);$('#news_ticker').css('line-height',0);$('#news_ticker').text('');$('#news_ticker').append(ul);$('#news_slides li').each(function(){lis.push($(this));});newSlide();}});}};function newSlide()
{var window_w=$('#news_ticker').width();var cur_li=lis[cur_lis_inx];var cur_w=0;for(var a=0;a<cur_lis_inx+1;a++)
{cur_w-=lis[a].width();}
var cur_left=parseInt($('#news_slides').css('left'));if(cur_left-window_w<cur_w)
{var cur_li_cloned=cur_li.clone();$('#news_slides').append(cur_li_cloned);lis=new Array();$('#news_slides li').each(function(){lis.push($(this));});cur_lis_inx=cur_lis_inx<lis.length-1?cur_lis_inx+1:0;}
setTimeout(function(){var next_left=parseInt($('#news_slides').css('left'))-1;$('#news_slides').css('left',next_left+'px');newSlide();},25);};function initBigImage()
{if($('.big_img img').length!=0)
{$(window).resize(function()
{var top_space=parseInt($('#navigation').css('top'))+parseInt($('#navigation').height())+18+parseInt($('#top_imgs_row').height())+18;var btm_space=parseInt($('#footer').height());var size=scaleSize(1024,$(window).height()-(top_space+btm_space),$('.big_img img').width(),$('.big_img img').height());var margin_left=(1024-size[0])/2;$('.big_img img').css({'width':size[0],'height':size[1],'margin-left':margin_left});});$(window).resize();}};function scaleSize(winW,winH,imgW,imgH)
{var ratio=imgH/imgW;var returnW;var returnH;var win_w=winW;var win_h=winH;returnW=win_w;returnH=returnW*ratio;if(returnH>win_h)
{returnH=win_h;returnW=returnH/ratio;}
return[Math.round(returnW),Math.round(returnH)];};
