function setWidthBg(cw,elm,y){
    var rw = getWidth() - cw;
    $(window).bind('resize',function(){
        rw = getWidth() - cw;
        if(y) rw += 108;
        elm.width(rw);
    });    
    if(y){
        rw += 108;
        $('#m').css({right:0});
    }    
    elm.width(rw);
}

// google geocoder
function initialize(lng,lat) {
    
    var latlng = new google.maps.LatLng(lng,lat); 
    var myOptions = {
      zoom: 18,
      backgroundColor:'black',
      disableDefaultUI: true,
      center: latlng,
      mapTypeId: google.maps.MapTypeId.ROADMAP
    };
    var map = new google.maps.Map(document.getElementById("morrowMap"),myOptions);
    var marker = new google.maps.Marker({
         position: latlng
    });
    var contentString = '<div id="content">'+
                            '<p>Motor here </p>'+
                            '<p>address here</p>'+
                        '</div>';
    var infowindow = new google.maps.InfoWindow({
         content: contentString
    });
     marker.setMap(map);
     infowindow.open(map,marker);
     
     windowResize();
}

//
function windowResize(){
    $(window).bind('resize',function(){
        $('#morrowMap > *').css({height:getHeight(),width:getWidth()});
        $('.mask').animate({left:0},'slow');
    });
}
//
function hideInfoDesc(){
    console.log('hideInfoDesc called');// bug to fix when we move the mouse quickly 
    $('.itemInfo').hide().addClass('hideMe').parent('.item').removeClass('pointer');
    site.bool.hover = site.bool.move = false;
}
//
function about3dEffect(){
    return false;
    try{
        var w = (getWidth() /4);
        var carousel = document.getElementById('carousel'),
            panelCount = carousel.children.length,
            theta = 0,
            container = $(".ab-3d"),
            rotateCarousel = function(index){
                carousel.style.webkitTransform = 'translateZ( -550px ) rotateY(' + index + 'deg)';
            },
            centerElm = function(){
                container.css({marginLeft:w});
                $(window).bind('resize',function(){
                    w = (getWidth() / 4);
                    container.css({marginLeft:w});
                });
                
                console.log('about3dEffect : centerElm ok');
            };
        
        rotateCarousel(-30);
            
        $('.figure').each(function(index,elm){
            $(this).bind('click',function(){
                var i = - (index * 30);
                rotateCarousel(i); 
            }); 
        });
        centerElm();   
    }catch(e){}
}
//
function setPos(elm,pos){
    elm.css({marginLeft:pos});
}
//
function playBtPos(){
    $('.reel-box .play').css({top:(getHeight()/3) + 100});
}
//
function setWidth(elm,w){
    $(elm).width(w);
}
//
function setHeight(elm,h){
    $(elm).height(h);
}

function keepRatio(elm,w,h){
    //elm
}
//
function isiPad(){
    return (navigator.platform.indexOf("iPad") != -1);
}

function isiPhone(){
    return (navigator.platform.indexOf("iPhone") != -1);
}
