 if(document.all)
  $(window).keypress(function(e)    
    {    
       e = e || window.event;
        switch(e.keyCode)    
        {    
            // user presses the "<--"    
            case 37:   
            $("a.bx-prev").click();
            break;           
            // user presses the "-->"    
            case 39:   
           $("a.bx-next").click();
          break;                             
             
        }    
    });

var Sys = {};
var ua = navigator.userAgent.toLowerCase();
if (window.ActiveXObject)
Sys.ie = ua.match(/msie ([\d.]+)/)[1];
//loading default

var _ourwork;
var _ourWay;
var _ourPeople;
var _contact;
var _locationList;

var urlHasChanged;

$(document).ready(function() {
 _ourwork = $("#workList").attr("href");
 _ourWay = $("#wayList").attr("href");
 _ourPeople = $("#peopleList").attr("href");
 _contact = $("#contactUs").attr("href");
 _locationList = $("#locationList").attr("href");
/*history start*/
 $.history.init(function(url) {   
    
                url = unescape(url);
                switch(url.replace('anchor=',''))
                {
                    case "ourWork":                    
                    showHeaderList('workList',_ourwork );
                    break;
                    case "ourWay":showHeaderList('wayList',_ourWay);
                    break;
                    case "ourPeople":showHeaderList('peopleList',_ourPeople);
                    break;
                    default: closeShowList();
                }
                 
                if(url.indexOf('WId=') != -1 && !urlHasChanged )
               {
                 var wkId = url.split('WId=')[1];
                 //if cookie is null create it
                 if(!$.cookie('WorkIdList'))
                 {
                   $.ajax({
                      type: "GET",
                      async:false,
                      dataType: 'html',
                      url: "/getallworklist.aspx",
                      cache: false,
                      success: function(list)
                      {
                         if($.trim(list).length > 0)
                         {
                             list=list.substring(0,$.trim(list).length-1);
                             var hostName='.profero.com';//document.location.host;
                             $.cookie("WorkIdList", null);
                             $.cookie("WorkIdList",list,{expires:1,path:'/',domain:hostName,secure:false});
                         }
                      }
                    });
                 }
              
                 var wkList;
                 wkList = $.cookie('WorkIdList');
                 if(null !=wkList &&  wkList.length > 0)
                 {
                   wkList = wkList.split('-');
                   for(var i = 0; i<wkList.length;i++)
                   {
                    if(wkList[i] == wkId)
                    {
                        var liID = "#WK" + wkId ;
                        if($("#mainBody")) $("#mainBody").hide();
                        getWorkContentById(wkId ,"work");
                        urlHasChanged = false;
                        return;
                    }
                   }
                 }
                }
                else if(url.indexOf('SId=') != -1 && !urlHasChanged)
                {
                 if(_slider)
                        {
                  var stId = url.split('SId=')[1];
                    if($("#WK0").length == 0)
                    {
                      var storyList ;
                      if(JSONObject.storyWork != null ) storyList = JSONObject.storyWork.split(',');
                      CreateStoryLiWithoutGoto(storyList,storyList.length -1);
                    }
                    if($("#mainBody")) $("#mainBody").hide();
                    _slider.getStoryContentByIndex(Number(stId) );
                    urlHasChanged = false;
                    return;
                }
                }
                else if(url.indexOf('PId=') != -1 && !urlHasChanged)
                {
                
                var peId = url.split('PId=')[1];
              
                 var peList = $.cookie('PeopleIdList');
                 
                 if(null !=peList &&  peList.length > 0)
                 {
                  peList = peList.split('-')
                 }
                 for(var i = 0; i<peList.length;i++)
                 {
                  if(peList[i] == peId )
                  {
                   if($("#mainBody")) $("#mainBody").hide(); 
                   getPeopleContentById(peId ,"people");
                    urlHasChanged = false;
                    return;
                  }
                 }
                }
                else if(url == "")
                 {
                   var currectUrl = window.location.toString().replace(window.location.search,"");
                   var storyPath = unescape($.cookie("PFStoryPath")) ;
                   if(currectUrl == storyPath + "#" || currectUrl == storyPath )
                   {
                        if(_slider)
                        {
                        if($("#WK0").length == 0 )
                        {
                          var storyList ;
                          if(JSONObject.storyWork != null ) storyList = JSONObject.storyWork.split(',');
                          CreateStoryLiWithoutGoto(storyList,storyList.length -1);
                        }
                        if($("#mainBody")) $("#mainBody").hide();
                        _slider.getStoryContentByIndex(0);
                        urlHasChanged = false;
                        
                   }
                   }
                   else
                   {
                     if($("#mainBody")) $("#mainBody").show();
                     if($("#pa")) $("#pa").hide();
                     if($("#map_canvas").length > 0) 
                     {
                       var sWidth;
                       var sHeight;
                       if(Math.max(document.body.scrollWidth,document.documentElement.scrollWidth) > document.documentElement.clientWidth)
                         sHeight= document.documentElement.clientHeight+15;
                       else
                         sHeight= document.documentElement.clientHeight;
                       $("#map_canvas").height(sHeight);
                       
                       if(Math.max(document.body.scrollHeight,document.documentElement.scrollHeight) > document.documentElement.clientHeight)
                         sWidth = document.documentElement.clientWidth + 15;
                       else
                         sWidth = document.documentElement.clientWidth;
                       $("#map_canvas").width(sWidth );
                     }
                   }
                    if($("body").hasClass("blackBg")) $("body").removeClass("blackBg");
                 }
                urlHasChanged = false;
   
     });
   $('#headerContent a').live('click',function(e) {
              var url = $(this).attr('href');
              if(url.indexOf("contact-us")>0 ||url.indexOf("twitter.com")>0 || url.indexOf("facebook.com")>0 ||url.indexOf("youtube.com")>0 ) return true;
              url = url.replace(/^.*#/, '');
              var  currentUrl = window.location.hash.replace(/^.*#/, '');
              if(url !=currentUrl )
              {
                 $.history.load(url);
              }
              else
              {
               switch(url.replace('anchor=',''))
                {
                    case "ourWork":                    
                    showHeaderList('workList',_ourwork );
                    break;
                    case "ourWay":showHeaderList('wayList',_ourWay);
                    break;
                    case "ourPeople":showHeaderList('peopleList',_ourPeople);
                    break;
                    default: closeShowList();
                }
               }
              return false;
            });
/*history end*/


  isiPad = navigator.platform.indexOf('iPad') !== -1;
  isiPod = navigator.platform.indexOf('iPod') !== -1;
  isiPhone = navigator.platform.indexOf('iPhone') !== -1;
  if(isiPad || isiPhone || isiPod || Sys.ie  ==  "6.0" ){
    //window.location.href="http://comingsoon.profero.com/default_en.php"; 
  }
  
  $("a.headerLogo").show();
  //$(".share").css({"bottom":"0","display":"none"});
  $(".searchHead").hide().css({"top":"0"});
  $(".publicHead").height(100);
  $("#locationArea,.locationArea,#siteMapList").attr("href","javascript:void(0);");
  $("#workList").attr("href","#ourWork");
  $("#wayList").attr("href","#ourWay");
  $("#peopleList").attr("href","#ourPeople");
 // $(".locationArea").attr("href","javascript:void(0);");
  $(".dropDownContentFooter").show();
  $("#header").stop().animate( {top:"0"},{duration:1000,queue:true});
  $("#share").show();
  followUs();
   if(!document.all)
  document.onkeyup=function(e)    
    {    
       e = e || window.event;
        switch(e.keyCode)    
        {    
            // user presses the "<--"    
            case 37:   
            $("a.bx-prev").click();
            break;           
            // user presses the "-->"    
            case 39:   
           $("a.bx-next").click();
          break;                             
             
        }    
    };  
  
if(document.getElementById('example'))  
document.onmousemove = (function() {
    var _mX =0;
    var _mY =0;
    var _arrowW = 0;
    var _arrowH = 0;      
    var _horW = 0;
    var _cH =0;
    var IE = document.all ? true : false;  

    var onmousestop = function() {
      if(_arrowW ==0){
        _arrowW = $("a.bx-prev").width();
        _arrowH = $("a.bx-prev").height();
      }
      _horW = document.documentElement.clientWidth;
      _cH = document.documentElement.clientHeight;
      if(_horW > document.documentElement.scrollWidth) _hor = document.documentElement.scrollWidth;
      if((_mX > _arrowW && _mX <= document.documentElement.clientWidth / 2 )
         || (_mX < (_horW - _arrowW)&& _mX > _horW / 2 ) 
         || _mY >(_cH - _cH / 20) ){
         $("a.bx-prev").hide();
         $("a.bx-next").hide();
      }
        $("#example").onmousemove = function(e) {
        if(e||event){
          if(!IE){
            _mX = e.clientX;
            _mY = e.clientY;
          }else{
            _mX = event.clientX;
            _mY = event.clientY;
          }
        }
        if(_slider && _slider.getCurrentSlide()> 0)  
          $("a.bx-prev").show();
        else if(_slider) 
          $("a.bx-prev").hide();
        if(_slider && _slider.getCurrentSlide() == _slider.getSlideCount()-1)  $("a.bx-next").hide();
        else if(_slider) $("a.bx-next").show();
    };
    }, thread;

    return function() {
        clearTimeout(thread);
        thread = setTimeout(onmousestop, 1500);
    };
})();  
  
});

//show search box
function showSearch(){
  $("#header").stop().animate( {duration:500,queue:true});
  $("#header").queue(function () {
    $("#searchHead").slideDown(500);  
  });
}
//close search box
function closeSearch(){
  $("#header").stop().animate( {duration:500,queue:true});
  $("#header").queue(function () {
    $("#searchHead").slideUp(500);
  });
}
//share sns
function followUs(){
  $snsName=$("ul.share>li");
  $snsName.each(function(){
    $(this).hover(function(){
      var sns=$(this).attr("id");
      //element_rock(sns);
    });
    $(this).click(function(){
      var sns=$(this).attr("id");
      if (sns!="search" && sns!="")
      {
        //alert(sns);
      }
      
    });
  });
};

//dropdown list
function filter(){
    $.ajax({
        type: "GET",
        url: "/topfilter.aspx",
        cache: false,
        
        success: function(html)
        {
          $(".showwrap").html(html);
          $("#filterList").slideDown(800,function(){
                $("#filter").hide();
          });
        },
        error: function()
        {
          (".showwrap").html("error");
          $("#filterList").slideDown(800);
        }
      });
}

function filterPeople(){
  $.ajax({
    url: "/topfilterpeople.aspx",
    cache: false,
    success: function(html){
      $(".showwrap").html(html);
      $("#filterList").slideDown(800,function(){
        $("#filter").hide();
      });
    },
    error:function(){
      $(".showwrap").html("error");
      $("#filterList").slideDown(800);
    }
  });
}
 


  
function wrapClose(){
  $("#filterList").slideUp("slow");
  $("#filter").show();
}

function showDrawer(obj,url){
  var pageH = $(document).height();
   var screenH  =  window.screen.availHeight;
  isiPad = navigator.platform.indexOf('iPad') !== -1;
  // $("#loadingPage").show();
  var pageH = $(document).height();
  $.ajax({
    type: "GET",
    dataType: 'html',
    url: url,
    data:{ajax:1},
    cache: true,
   
    success: function(html){
      $("#show_List").addClass(obj);
      if($(".dropDownContent").length == 0)
      {
          $("#dropDownContent").append("<div class='dropDownContent'></div>");
      }
      $(".dropDownContent").html(html);
      
      if(obj.toLowerCase() == "worklist")
      {
          $("<scri"+"pt>"+"").attr({src:'/scripts/Work.js',type:'text/javascript',id:'workIdList'}).appendTo($('head'));
      }
      
      if(obj.toLowerCase() == "peoplelist")
      {
        $("<scri"+"pt>"+"").attr({src:'/scripts/People.js',type:'text/javascript',id:'peopleIdList'}).appendTo($('head'));
      }
      
      $(".publicHead").show().css({
        "z-index":"999999"
      });
      $("li object").hide();
      $("li embed").hide();
      
        $("#loadingPage").hide();  
      //$("#loadingPage").hide(1000,function(){
        $(document).scrollTop(0); 
        $(".dropDownContent").height(screenH);
        $("."+obj).show().animate({top: '0'}, 
                  {duration:500,
                   easing:"easeOutCubic",
                   step:function(now){
                     
                     if(now >= ( -$(".dropDownContent").height() + document.documentElement.clientHeight-65) || now==0 )
                    {
                      if(Sys.ie  ==  "6.0"){
                        $("#copyFoot").stop().css({
                            "position":"relative",
                            "width":"99.8%",
                            "z-index":"99999",
                            "text-align":"center"
                         });
                    }else{
                      $("#copyFoot").stop().css({
                            "position":"fixed",
                            "width":"89.8%",
                            "z-index":"99999",
                            "left":"50%",
                            "margin-left":"-45%",
                            "text-align":"center" ,
                            "bottom":"-2px" 
                         });
                    }
                      }
                     
                   },
                   complete:function(){
                     var h = document.documentElement.clientHeight;
          $(".informationIcon").hide();
          $(".dropDownContent").height(h+150);
                     
                     $("#slider1").css({
                       "height":h+150,
                       "overflow":"hidden"
                     });
          /*
          var pH  =document.documentElement.clientHeight;
          var dropDownContentHH  =  pageH-65;
          $(".dropDownContent").height(dropDownContentHH);
            $("#copyFoot").css({
              "position":"fixed",
              "width":"89.8%",
              "z-index":"99999",
              "left":"50%",
              "margin-left":"-45%",
              "text-align":"center", 
              "bottom":"0px"
            });
            
            $("#copyFoot").stop().animate({bottom:"0px"}, 1000);
          */
       /*
          if(dropDownContentHH < pageH){
            $(".dropDownContent").height(dropDownContentHH);
             $("#copyFoot").css({
              "position":"fixed",
              "width":"89.8%",
              "z-index":"99999",
              "left":"50%",
              "margin-left":"-45%",
              "text-align":"center" ,
              "bottom":"-65px" 
            }); 
            
              $("#copyFoot").stop().animate({bottom:"0px"}, 1000);
           
            
          }else{
            var dropDownContentHH  =  pageH-40;
            $(".dropDownContent").height(dropDownContentHH);
            $("#copyFoot").css({
              "position":"fixed",
              "width":"89.8%",
              "z-index":"99999",
              "left":"50%",
              "margin-left":"-45%",
              "text-align":"center", 
              "bottom":"-65px"
            });
            
              $("#copyFoot").stop().animate({bottom:"0px"}, 1000);
          
           
          }
        */ 
            //our work page
            if(obj == "workList")
            {
              OurWorkAnimate();
               if(typeof(_gaq)!='undefined'){
                _gaq.push(['_trackPageview', _ourwork]);
              }
              //Our work page work scorll bar
             if($("#idContent").length > 0)
              ScrollbarCommon("","idContent","scrollWorks","idSlider","idBar"); 
              
              //Our work page client scorll bar
             if($("#idClientsContent").length > 0)
              ScrollbarCommon("","idClientsContent","scrollClientsContent","idClientsSlider","idClientsBar"); 
              
            }
            else if(obj == "peopleList")
            {
               if(typeof(_gaq)!='undefined'){
                _gaq.push(['_trackPageview', _ourPeople]);
              }
              //Our people page people scorll bar 
              if($("#iddContentA").length > 0)
              ScrollbarCommon("","iddContentA","scrollContent","iddSliderA","iddBarA");

            }
            else if(obj == "wayList")
            {
               if(typeof(_gaq)!='undefined'){
                _gaq.push(['_trackPageview', _ourWay]);
              } 
              
                            
            

            }

        }});
        
      //});
      
      
      document.title = $("#title").text();
    }

  })   
}
function showHeaderList(obj,url){
  var _CSSClss =  $("#show_List")[0].className;
  if(_CSSClss == obj){
    return;
  }else{
    if($(".dropDownContent").length != 0){
       closeShowList();
        $("#loadingPage").show();
      setTimeout(function(){showDrawer(obj,url);},500);
    }else {
      $("#loadingPage").show();
      showDrawer(obj,url);
    }
  }
   

}

function showLocation(obj,url){
   var pageH = $(document).height();
   var screenH  =  window.screen.availHeight;
  isiPad = navigator.platform.indexOf('iPad') !== -1;
  $("#loadingPage").show();
  var pageH = $(document).height();
  $.ajax({
    type: "GET",
    dataType: 'html',
    url: url,
    data:{ajax:1},
    cache: true,
   
    success: function(html){
      if(typeof(_gaq)!='undefined'){
                _gaq.push(['_trackPageview', _locationList]);
              } 
      $("#show_List").addClass(obj);
      if($(".dropDownContent").length == 0)
      {
          $("#dropDownContent").append("<div class='dropDownContent'></div>");
      }
      $(".dropDownContent").html(html);
      
      $(".publicHead").show().css({
        "z-index":"999999"
      });
      
      
            
      $("#loadingPage").fadeOut(500,function(){
        $(document).scrollTop(0);
        $("."+obj).show().animate({top: '0'}, 100,"easeOutCubic",function(){
          $(".informationIcon").hide();
          var dropDownContentH  =  $(".dropDownContent").height();
          var dropDownContentHH = dropDownContentH; 
          var pH  =document.documentElement.clientHeight;
          if(dropDownContentH < pH){
            
             var dropDownContentHH  =  pageH-40;
            
           // var dropDownContentHH  =  pageH-65;
            $(".dropDownContent").height(dropDownContentHH);
            if(Sys.ie  ==  "6.0"){
                $("#copyFoot").stop().css({
                   "position":"relative",
                   "width":"99.8%",
                   "z-index":"99999",
                    "text-align":"center"
                 });
            }else{
            $("#copyFoot").css({
              "position":"fixed",
              "width":"89.8%",
              "z-index":"99999",
              "left":"50%",
              "margin-left":"-45%",
              "text-align":"center",
              "bottom":pH-(dropDownContentH+65)
            });
            if(isiPad){
              $("#copyFoot").stop().animate({bottom:"-40px"}, 1000);
            }else{
              $("#copyFoot").stop().animate({bottom:"0px"}, 1000);
            }
          }
          }else{
            $(".dropDownContent").height(dropDownContentHH+65);
          if(Sys.ie  ==  "6.0"){
              $("#copyFoot").stop().css({
                "position":"relative",
                "width":"99.8%",
                "z-index":"99999",
                "text-align":"center"
              });
          }else{
            $("#copyFoot").css({
              "position":"fixed",
              "width":"89.8%",
              "z-index":"99999",
              "left":"50%",
              "margin-left":"-45%",
              "bottom":"-65px",
              "text-align":"center"
            });
            if(isiPad){
              $("#copyFoot").stop().animate({bottom:"-40px"}, 500);
            }else{
              $("#copyFoot").stop().animate({bottom:"0px"}, 500);
            }
          }
           
          }
         

         });
        
      });

    }

  })   

}

function showHeaderListA(obj,url,workId){
   var pageH = $(document).height();
   var screenH  =  window.screen.availHeight;
  isiPad = navigator.platform.indexOf('iPad') !== -1;
  $("#loadingPage").show();
  var pageH = $(document).height();
  $.ajax({
    type: "GET",
    dataType: 'html',
    url: url,
    data:{ajax:1},
    cache: false,
   
    success: function(html){
      if(obj == "workList"){
         if(typeof(_gaq)!='undefined'){
              _gaq.push(['_trackPageview', _ourwork]);
            }
      }
      else if(obj == "peopleList"){
         if(typeof(_gaq)!='undefined'){
                _gaq.push(['_trackPageview', _ourPeople]);
              }
        }
      else if(obj == "wayList"){
          if(typeof(_gaq)!='undefined'){
                _gaq.push(['_trackPageview', _ourWay]);
              } 
      }
      //$(".dropDownContent").append($('#dropDownContent'));
      if($(".dropDownContent").length == 0)
      {
          $("#dropDownContent").append("<div class='dropDownContent'></div>");
      }
      $(".dropDownContent").html(html);
      
      
      //$("<scri"+"pt>"+"").attr({src:'/scripts/sliderbar.js',type:'text/javascript',id:'loadSlider'}).appendTo($('head'));
      $("<scri"+"pt>"+"").attr({src:'/scripts/Work.js',type:'text/javascript',id:'workIdList'}).appendTo($('head'));
      $("<scri"+"pt>"+"").attr({src:'/scripts/People.js',type:'text/javascript',id:'peopleIdList'}).appendTo($('head'));
      
      $(".publicHead").show().css({
        "z-index":"999"
      });
      $("#loadingPage").fadeOut(1000,function(){
        $("."+obj).show().animate({top: '0'}, 2000,"easeOutCubic",function(){
          $(".informationIcon").hide();
          var dropDownContentH  =  $(".dropDownContent").height();
          var dropDownContentHH = dropDownContentH;
          var pH  =document.documentElement.clientHeight;
         
      });       
      });
      document.title = $("#title").text();
      getRelatedWorkContentById(workId);
    }

  })   

}
      function showHeaderListB(obj,url,workId){
   var pageH = $(document).height();
   var screenH  =  window.screen.availHeight;
  isiPad = navigator.platform.indexOf('iPad') !== -1;
  $("#loadingPage").show();
  var pageH = $(document).height();
  $.ajax({
    type: "GET",
    dataType: 'html',
    url: url,
    data:{ajax:1},
    cache: false,
   
    success: function(html){

      //$(".dropDownContent").append($('#dropDownContent'));
      if($(".dropDownContent").length == 0)
      {
          $("#dropDownContent").append("<div class='dropDownContent'></div>");
      }
      $(".dropDownContent").html(html);
      
      
      //$("<scri"+"pt>"+"").attr({src:'/scripts/sliderbar.js',type:'text/javascript',id:'loadSlider'}).appendTo($('head'));
      $("<scri"+"pt>"+"").attr({src:'/scripts/Work.js',type:'text/javascript',id:'workIdList'}).appendTo($('head'));
      $("<scri"+"pt>"+"").attr({src:'/scripts/People.js',type:'text/javascript',id:'peopleIdList'}).appendTo($('head'));
      
      $(".publicHead").show().css({
        "z-index":"999"
      });
      $("#loadingPage").fadeOut(1000,function(){
        $("."+obj).show().animate({top: '0'}, 2000,"easeOutCubic",function(){
          $(".informationIcon").hide();
          var dropDownContentH  =  $(".dropDownContent").height();
          var dropDownContentHH = dropDownContentH;
          var pH  =document.documentElement.clientHeight;
          

         });  
      });
      document.title = $("#title").text();
      getPeopleContentById(workId,"people");
    }

  })   

}
    
//slider scroll bar    
function ScrollbarCommon(tempID,obj,scrollContent,idSlider,idBar)
{
  var objDiv="";
  var _containerW =0;
  var _liL =0;
  var _contentW =0;
    
  if(tempID !="")
  {   
    objDiv="#"+obj+tempID;
    _containerW = $(objDiv).width();
    _liL = $("#"+obj+tempID+" li").length;
    //_contentW = $("."+scrollContent+" li").width()*_liL;
    //fix related work ul width from setmap bug
    var liwidth = 0;
    if($(objDiv +" li").length > 0 && $("."+scrollContent+" li").css("width") != null)
      liwidth = Number($("."+scrollContent+" li").css("width").replace("px",""))+1;
   /* if(!isNaN(liwidth))
      _contentW = liwidth *_liL;*/
    $(objDiv +" li").each(function(){
        if($(this).width() == 0)
           _contentW+=(Number($(this).css("width").replace("px","")) + 1);
      else
          _contentW+=($(this).width() + 1);
    });
    $(objDiv +" ul").css({
     "width":_contentW
    });
    
    var tempObj=obj+tempID;
    var tempidSlider=idSlider+tempID;
    var tempidBar=idBar+tempID;
    var sliderCommon = new Slider(tempidSlider,tempidBar, {
    MaxValue: $$(tempObj).scrollWidth - $$(tempObj).clientWidth,
    onMove: function(){ $$(tempObj).scrollLeft = this.GetValue(); }
    });

    sliderCommon.SetPercent(0);
    sliderCommon.Ease = true;
        if(_containerW > _contentW)
    {
        $("#"+tempidSlider).hide();
    }
    else
    {
      $("#"+tempidSlider).show();
    }
  }
  else
  {    
   if($$(obj) != null){
    objDiv="#"+obj;
    _containerW = $(objDiv).width();
    _liL = $("#"+obj+" li").length;
    //_contentW = Number($("."+scrollContent+" li").width()+1)*_liL;
    $("."+scrollContent+" li").each(function(){_contentW+=($(this).width() + 1);});
    $("."+scrollContent+" ul").css({
     "width":_contentW
    });
    
    var sliderCommon = new Slider(idSlider,idBar, {
    MaxValue: $$(obj).scrollWidth - $$(obj).clientWidth,
    onMove: function(){ $$(obj).scrollLeft = this.GetValue(); }
    });

    sliderCommon.SetPercent(0);
    sliderCommon.Ease = true;

    if(_containerW > _contentW)
    {
        $("#"+idSlider).hide();
    }
    else
    {
        $("#"+idSlider).show();
    }
     
   }
  }
        
    
}    

//reset slider scroll bar with visible Elements 
function ScrollbarOnlyVisible(obj,scrollContent,idSlider,idBar)
{
  var objDiv="";
  var _containerW =0;
  var _liL =0;
  var _contentW =0;
  
   if($$(obj) != null){
    objDiv="#"+obj;
    _containerW = $(objDiv).width();
    _liL = $("#"+obj+" li:visible").length;
    //_contentW = Number($("."+scrollContent+" li").width()+1)*_liL;
     $("."+scrollContent+" li").each(function(){
       if($(this).css('display') != "none") 
       {
       if($(this).width() == 0)
           _contentW+=(Number($(this).css("width").replace("px","")) + 1);
      else
          _contentW+=($(this).width() + 1);
     }
    });
    $("."+scrollContent+" ul").css({
     "width":_contentW
    });
     //reset scrollLeft
    $$(obj).scrollLeft = 0;
    if(_containerW > _contentW)
    {
        $("#"+idSlider).hide();
    }
    else
    {
      $("#"+idSlider).show();
    }
   }
}    

function OurWorkAnimate()
{
    $('.scrollWorks li').hover(function() {
    // over
    $(this).children('img').stop().animate({
      top : '-230px'
    }, 500);
    //$(this).children(".sponsorData").fadeOut(500);
  },
  function() {
    // out  
    $(this).children('img').stop().animate({
      top : '0'
    }, 500);
    //$(this).children(".sponsorData").fadeIn(500);
  });
    
 /*
  $('.scrollClientsContent li').hover(function() {
      // over
    $(this).children('img').stop().animate({
      top : '-75px'
    }, 500);
  },
  function() {
    // out  
    $(this).children('img').stop().animate({
      top : '0'
    }, 500);
  });
  */
}
    
function showContactUs(obj,url){
 $("#loadingPage").show();
  $.ajax({
    type: "GET",
    dataType: 'html',
    url: url,
    data:{ajax:1},
    cache: false,
    success: function(html){
             
      $(document.body).html(html);
      $("#loadingPage").hide();

     document.title = $("#title").text();
    }
  });
 }
  
function closeShowList(){
  var dropDownContentH  =  $("#show_List").height();
  $(".publicHead").show().css({
    "z-index":"999999"
  });
  $("#copyFoot").css({
    "position":"relative",
    "width":"99.8%",
    "left":"50%",
    "margin-left":"-50%"
  });
  $("#show_List").stop().animate({top: -(dropDownContentH+65)},500,function(){
     $("#masks").hide();
    $(".publicHead").show().css({
      "z-index":"99999"
    });
    $("#show_List .dropDownContent").remove();
    $("#show_List").hide().removeClass();
    $(".informationIcon").show();
  });
  
  $("li object").show();
  $("li embed").show();
}

function showPageH(){
 $("#slider1").css({
     "height":"auto",
     "overflow":"auto"
   });
}

function showContactList(){
  $("#openContactList").hide();
  $("#closeContactList").show();
  $("#showContactList").stop().animate( {bottom:"0"},{duration:500,queue:true});
}
function hideContactList(){
  $("#openContactList").show();
  $("#closeContactList").hide();
  $("#showContactList").stop().animate( {bottom:"-500px"},{duration:500,queue:true});
}
/*
function showInformation(){
  $("#show_List").slideUp(500);
  $(".publicHead").show();
  $("#header").stop().animate( {duration:500,queue:true});
  $("#header").queue(function () {
    $("#informationHead").slideDown(500);  
  });
}
function closeInformation(){
  $("#header").stop().animate( {duration:500,queue:true});
  $("#header").queue(function () {
    $("#informationHead").slideUp(500);  
  });
}
*/
function showInformation(){
  $("#show_List").slideUp(500);
  $(".publicHead").show();
  $(".container").show();
  $("#header").stop().animate( {duration:500,queue:true});
  $("#header").queue(function () {
    $("#informationHead").slideDown(500);  
  });
}
function closeInformation(){
  $(".container").show();
  $("#header").stop().animate( {duration:500,queue:true});
  $("#header").queue(function () {
    $("#informationHead").slideUp(500);  
  });
}

function showSiteMap(obj){
  $("#loadingPage").show();
  $.ajax({
    url: obj,
    cache: false,
    success: function(html){
      $(".siteMap").html(html);
      var _siteMapH  =  $(".siteMap").height();
      $(".siteMap").css({
        "bottom":-_siteMapH
      });
      $("#loadingPage").fadeOut(300,function(){
        $(".siteMap").show().animate( {bottom:"0px"},1500,function(){
          $(".closeSiteMapBtn").fadeIn(500);
          $(".informationIcon").fadeOut(500);
        });
      });


       $("#pageType").remove();
       $("<div/>").attr("id","pageType").html("sitemap").css("display","none").insertAfter("#pa");
     
    }
  })
}
function hideSiteMap(){
  var _siteMapH  =  $(".siteMap").height();
  $(".siteMap").stop().animate( {bottom:-_siteMapH},1500,function(){
    $(".siteMap").empty();
    $(".closeSiteMapBtn").fadeOut(300);
    $(".informationIcon").fadeIn(300);
  });
}

function showlocationPop(){
  $("#locationPopBox").css({
  "top":"100px",
  "left":"0"
  });
  $.ajax({
    url: "/plan.html",
    cache: true,
    success: function(html){
      $("#locationPopBox").html(html);
      $("#locationPopBox").show().animate( {left:"50%"},300);
    },
    error:function(){
      $("#locationPopBox").html("error");
      $("#locationPopBox").show().animate( {left:"50%"},300);
    }
  });
}
function closelocationPop(){
  $("#locationPopBox").show().animate( {top:"-1000"},500,function(){
    $("#locationPopBox").css({
      "left":"-50%",
      "top":"100px"
    })
  });
}
