/* resource page menu
function viewBy(){
    jQuery('#menu ul').hide();
    jQuery('#menu ul:first').show();
    jQuery('#menu li a').click(function(){
        var checkElement=jQuery(this).next();
        if((checkElement.is('ul'))&&(checkElement.is(':visible'))){
            return false;
        }
        if((checkElement.is('ul'))&&(!checkElement.is(':visible'))){
            jQuery('#menu ul:visible').slideUp('normal');
            checkElement.slideDown('normal');
            return false;
        }
    });
} */
jQuery(document).ready(function(){

//    jQuery('.rightsidebar h2:nth-of-type(1)').css('color','#999999');
//    jQuery('.rightsidebar h2:nth-of-type(2)').css('color','#7AC943');
    
    jQuery('.ideas ul li:last-child').css('margin-right','0');
    jQuery('.sharesocial ul li:last-child').css('border-right','none');
    jQuery('ul#menu li ul li:last-child a').css('border-bottom','none');
    jQuery('ul.viewby li:nth-child(3)').css('margin-right','0');
    jQuery('ul.viewby li:nth-child(6)').css('margin-right','0');
    jQuery('.span11 h2:nth-child(1)').css('color','#FF931E');
    jQuery('.aboutus h2:nth-child(1)').css({
        'color':'#999',
        'font-size':'4em',
        'margin':'90px 0 20px'
    });

    jQuery(".span16 h2:nth-child(1)").css({
        'border-bottom':'1px dashed #999999',
        'padding-bottom':'30px',
        'margin-bottom':'30px'
    });
    jQuery(".services h2:nth-child(1)").css({
        'border-bottom':'none',
        'padding':'0',
        'margin-bottom':'0',
        'font-size':'4em',
        'font-weight':'700',
        'text-align':'right'
    });
    jQuery("#whyussection h2:nth-child(1)").css({
        'border-bottom':'none',
        'padding':'0',
        'margin':'30px 0 32px',
        'font-size':'4em',
        'font-weight':'700',
        'text-align':'left',
        'line-height':'1em'
    });
    jQuery("#clientssection h2:nth-child(1)").css({
        'border-bottom':'none',
        'padding':'0',
        'margin':'10px 0 16px',
        'font-size':'4em',
        'font-weight':'700',
        'text-align':'center',
        //'line-height':'1em'
    });
    jQuery("#joinussection h2:nth-child(1)").css({
        'border-bottom':'none',
        'padding':'0',
        'margin':'30px 0 32px',
        'font-size':'4em',
        'font-weight':'700',
        'text-align':'left',
        'line-height':'1em'
    });
    jQuery(".innovationinnerslide h2:nth-child(1)").css({
        'border-bottom':'none',
        'padding':'0',
        'margin':'0 0 0 90px',
        'font-size':'4em',
        'font-weight':'700',
        'text-align':'left',
        'line-height':'1em'
    });


    jQuery("ul.language  li:last-child").css("border-right","none");
    jQuery(".collapse label[for$='strategy']").css("background-position","0px -23px");
    jQuery(".collapse label[for$='identity']").css("background-position","0px -46px");
    jQuery(".collapse label[for$='packaging']").css("background-position","0px -69px");
    jQuery(".collapse label[for$='environments']").css("background-position","0px -92px");
    jQuery(".collapse label[for$='activation']").css("background-position","0px -115px");
    jQuery(".collapse label[for$='foods']").css("background-position","0px -138px");
    jQuery(".collapse label[for$='beverages']").css("background-position","0px -161px");
    jQuery(".collapse label[for$='alcohol']").css("background-position","0px -184px");
    jQuery(".collapse label[for$='dairy']").css("background-position","0px -207px");
    jQuery(".collapse label[for$='baby']").css("background-position","0px -230px");
    jQuery(".collapse label[for$='personalcare']").css("background-position","0px -253px");
    jQuery(".collapse label[for$='homecare']").css("background-position","0px -276px");
    jQuery(".collapse label[for$='gss']").css("background-position","0px -299px");
    jQuery(".collapse label[for$='dsm']").css("background-position","0px -322px");
    jQuery(".collapse label[for$='mmce']").css("background-position","0px -368px");
    jQuery(".collapse label[for$='homegarden']").css("background-position","0px -391px");
    jQuery(".collapse label[for$='lrt']").css("background-position","0px -414px");
    jQuery(".collapse label[for$='healthwellness']").css("background-position","0px -437px");
    jQuery(".collapse label[for$='ps']").css("background-position","0px -461px");
    jQuery(".collapse label[for$='media']").css("background-position","0px -483px");
    jQuery(".collapse label[for$='govnonhealth']").css("background-position","0px -506px");
    jQuery(".collapse label[for$='automotive']").css("background-position","0px -529px");
    jQuery(".collapse label[for$='industrial']").css("background-position","0px -552px");
    jQuery(".collapse label[for$='miscellaneous']").css("background-position","0px -575px");
    jQuery("h3.ideasTag+div").css({
        'margin':'0 0 18px',
        'padding':'18px 18px',
        'background-color':'#F2F2F2',
        'position':'relative'
    });
    /*
    jQuery(".view_list_idea h2:first-of-type").css({
        'border-bottom':'1px dotted #999999',
        'padding-bottom':'5px'
    });
    */
    jQuery(".view_listgrid_idea h2:first-child").css({
        'border-bottom':'1px dotted #999999',
        'padding-bottom':'5px'
    });
    /*
    jQuery(".view_list_idea p:only-of-type").css({
        'border-bottom':'1px dotted #999999',
        'padding':'10px 0 5px'
    });
    */
    jQuery(".view_listgrid_idea ul.thumb_view li:last-child").css({
        'margin-right':'0'
    });
    jQuery("ul#pikame li:last-child").css({
        'margin-right':'0'
    });
    jQuery(".view_listgrid_idea ul.thumb_view:last-child").css({
        'border-bottom':'1px dotted #999999',
        'padding-bottom':'20px',
        'display':'block',
        'float':'left'
    });
    jQuery(".view_listgrid_idea ul.thumb_view li").hover(function(){
        href=jQuery(this).find("a").attr("href");
        //jQuery(this).append(jQuery('<span><a href="'+href+'">View this project</a></span>'));
        jQuery(this).append(jQuery('<span>View this project</span>'));
    },function(){
        jQuery(this).find("span:last").remove();
    });
        
    jQuery(".footerviewlist .view_listgrid_idea ul.thumb_view:last-child").css({
        'border-bottom':'none',
        'padding-bottom':'10px',
        'display':'block',
        'float':'left'
    });
    var $search=jQuery('#search');
    original_val=$search.val();
    $search.focus(function(){
        if(jQuery(this).val()===original_val){
            jQuery(this).val('');
        }
    }).blur(function(){
	    if(jQuery(this).val()===''){
	        jQuery(this).val(original_val);
	    }
	});

	var $newsletter=jQuery('#newsletter');
	    original_news_val=$newsletter.val();
	    $newsletter.focus(function(){
	    if(jQuery(this).val()===original_news_val){
	        jQuery(this).val('');
	    }
	}).blur(function(){
	    if(jQuery(this).val()===''){
	        jQuery(this).val(original_news_val);
	    }
	});
	var $searchShop=jQuery('#searchShop');
	original_searchShop_val=$searchShop.val();
	$searchShop.focus(function(){
	    if(jQuery(this).val()===original_searchShop_val){
	        jQuery(this).val('');
	    }
	}).blur(function(){
	    if(jQuery(this).val()===''){
	        jQuery(this).val(original_searchShop_val);
	    }
	});
	jQuery('#hnav').autosprites({
	    offset:'48px',
	    activeState:true,
	    activeSprites:true
	});
	jQuery("a.grid").click(function(){
	    jQuery(this).addClass("active");
	    jQuery("a.list").removeClass("active");
	});
	jQuery("a.list").click(function(){
	    jQuery(this).addClass("active");
	    jQuery("a.grid").removeClass("active");
	});
	jQuery("#viewbyDiscipline").css({
	    'display':'none'
	});
	jQuery("a#discipline").click(function(){
	    jQuery("#viewbyApplication").css({
	        'display':'none'
	    });
	    jQuery("#viewbyDiscipline").css({
	        'display':'block'
	    });
	});
	jQuery("a#application").click(function(){
	    jQuery("#viewbyDiscipline").css({
	        'display':'none'
	    });
	    jQuery("#viewbyApplication").css({
	        'display':'block'
	    });
	});
	jQuery(".radio").dgStyle();
	jQuery("#pikame").PikaChoose({
	    thumbOpacity:1,
	    showTooltips:true
	});
	jQuery('#maplocation').click(function(e){
	    e.preventDefault();
	    jQuery('#square44Map').reveal({
	        animation:'fadeAndPop',
	        animationspeed:300,
	        closeonbackgroundclick:false,
	        dismissmodalclass:'close-reveal-modal'
	    });
	});
	jQuery(".sathorn").mouseover(function(){
	    jQuery('.mapholder').css({
	        'background-position':'0px -441px'
	    });
	    jQuery(".reveal-modal .sathorn").css({
	        'background-color':'#f3f3f4'
	    });
	    jQuery(".reveal-modal .rama").css({
	        'background-color':'#ffffff'
	    });
	    jQuery(".reveal-modal .silom").css({
	        'background-color':'#ffffff'
	    });
	}).mouseout(function(){
	    jQuery(".reveal-modal .sathorn").css({
	        'background-color':'#fff'
	    });
	    jQuery('.mapholder').css({
	        'background-position':'0px 0px'
	    });
	    jQuery(".reveal-modal .rama").css({
	        'background-color':'#f3f3f4'
	    });
	    jQuery(".reveal-modal .silom").css({
	        'background-color':'#ffffff'
	    });
	});
	jQuery(".rama").mouseover(function(){
	    jQuery('.mapholder').css({
	        'background-position':'0px 0px'
	    });
	    jQuery(".reveal-modal .sathorn").css({
	        'background-color':'#ffffff'
	    });
	    jQuery(".reveal-modal .rama").css({
	        'background-color':'#f3f3f4'
	    });
	    jQuery(".reveal-modal .silom").css({
	        'background-color':'#ffffff'
	    });
	}).mouseout(function(){
	    jQuery('.mapholder').css({
	        'background-position':'0px 0px'
	    });
	    jQuery(".reveal-modal .sathorn").css({
	        'background-color':'#ffffff'
	    });
	    jQuery(".reveal-modal .rama").css({
	        'background-color':'#f3f3f4'
	    });
	    jQuery(".reveal-modal .silom").css({
	        'background-color':'#ffffff'
	    });
	});
	jQuery(".silom").mouseover(function(){
	    jQuery('.mapholder').css({
	        'background-position':'0px -882px'
	    });
	    jQuery(".reveal-modal .sathorn").css({
	        'background-color':'#ffffff'
	    });
	    jQuery(".reveal-modal .rama").css({
	        'background-color':'#ffffff'
	    });
	    jQuery(".reveal-modal .silom").css({
	        'background-color':'#f3f3f4'
	    });
	}).mouseout(function(){
	    jQuery('.mapholder').css({
	        'background-position':'0px 0px'
	    });
	    jQuery(".reveal-modal .sathorn").css({
	        'background-color':'#ffffff'
	    });
	    jQuery(".reveal-modal .rama").css({
	        'background-color':'#f3f3f4'
	    });
	    jQuery(".reveal-modal .silom").css({
	        'background-color':'#ffffff'
	    });
	});

    jQuery("#demo1 h3.expand").toggler({
        initShow:"div.collapse"
    });
    jQuery("#demo1").expandAll({
        trigger:"h3.expand",
        ref:"h3.expand",
        showMethod:"slideDown",
        hideMethod:"slideUp"
    });

});

/*
jQuery(function(){

    jQuery("#demo1 h3.expand").toggler({
        initShow:"div.collapse"
    });
    jQuery("#demo1").expandAll({
        trigger:"h3.expand",
        ref:"h3.expand",
        showMethod:"slideDown",
        hideMethod:"slideUp"
    });


});
*/

/*
var global=g={
    content_area:jQuery('#inner_content'),
    loadContent:function(type){
        if(type==''){
            return false;
        }
        jQuery.ajax({
            type:'GET',
            data:'type='+type,
            url:base_url+'content.php',
            success:function(data){
                g.content_area.html(data);
            }
        });
}
}
*/
