﻿			function ClearText()
			{    
		     
				if(document.Form1.txt_search_top.value == "please enter a keyword")
				{
		            
					document.Form1.txt_search_top.value = "";
				}
			}

function flashBanners(){

                //banner quote/image
                //if there's a quote in the content then use that, else default to generic 
                var contentQuote = $('#contentBox p').hasClass('bannerQuote');
                //alert(contentQuote);
                var totalQuotes = $('p.bannerQuote').size();
                if (totalQuotes>1 && !contentQuote){
                    var picked = Math.floor(Math.random()*totalQuotes);
                } else {
                    var picked = 0;
                }
                qTxt = $.trim($('p.bannerQuote:eq('+picked+')').text());
                cTxt = $.trim($('p.bannerCredit:eq('+picked+')').text());
                imgSrc = $('p.bannerSquare:first img').attr('src');
                imgNo = $.trim($('p.bannerSquare:first').text());

                $('#flashBox').flash({ 
                    swf: '/flash/sh_banner_09a.swf',
                    width: 995,
                    height: 154,
                    hasVersion: 8,
                    flashvars: {  quote: qTxt,  credit: cTxt, imgPath: imgSrc, squareID: imgNo },
                    params: {wmode: 'opaque'}
                    
                    });
                navAmends();


}

function addQuotes(){

                //Add quotes
                $('.quoteBounds p').prepend('<img src="/images/ui/quotemark_open.png" />').append('<img src="/images/ui/quotemark_close.png" />');
}

function globePanels(){

                //Globe
                $('#globeBox map area').each(function(){
                    var whichOne = $(this).attr('id');
                    var panelContent = $('#sfData div.'+whichOne).html();
                    var offset = $("#globeBox").offset();
			        var yPos = (offset.top)-155;
                    $(this).click(function(){
                        $('#globePanelClose').remove();
                        $('#globePanel').css('top',yPos-5).show().css('opacity',0.95).html(panelContent);
                        $('#globeBox').append('<div id="globePanelClose"></div>');
                        $('#globePanelClose').css('top',yPos).click(function(){
                            $('#globePanel').hide();
                            $(this).remove();
                        });
                    });
                    $(this).mouseover(function(){
                        $('#globe').attr('src','/images/globe/' + whichOne +'.png');
                    });
                    $(this).mouseout(function(){
                        $('#globe').attr('src','/images/globe/base.png');
                    });
                });
}

function keyContacts(){
                //Key Contacts
                $('.moreBtn').click(function(){
                        $(this).toggleClass('closeBtn');
                        $(this).next($('.moreInfo')).toggle('fast', function() {
                            // cleartype fix for IE7
                            if(jQuery.browser.msie){
                            this.style.removeAttribute('filter');}
                        });
                });
}

function navAmends(){
                //chinese characters in nav
                $('#navBox a.child1:last').html('<span lang="zh">中文</span>');
}
                        
