Ext.onReady(function(){
    Ext.QuickTips.init();
	//Ext.get('footerlinks').update('<a href="index.html">Home</a> | <a href="sitemap.html">Site Map</a> | <a href="about.html">About Us</a> | <a href="contactus.html">Contact Us</a> | <a href="news.html">News</a> | <a href="customers.html">Customers</a> | <a href="jobs.html">Jobs</a> | <a href="patents.html">Patents</a> | <a href="trademarks.html">Trademarks</a> | <a href="privacy.html">Privacy Policy</a> | <a href="termsofuse.html">Terms of Use</a> </div><div><table><tr><td><input type="text" id="search" name="search"/></td><td></td><td><div id="interact"></div></td></tr></table></div><div class="copyright" id="copyright">Copyright &copy; 2009 SCATE Technologies, Inc.  All rights reserved.<br/><a href="http://www.scate.com/">http://www.scate.com/</a> <br/><br/><div style="text-align: center;" align="center"><a target="_blank" href="http://www.bbbonline.org/cks.asp?id=108081320524"><img title="Click to verify BBB accreditation and to see a BBB report." border=0 src="images/bbbsealh1.gif" alt="Click to verify BBB accreditation and to see a BBB report." /></a></div><br/><br/>');
	//var siteroot = "http://10.1.1.3/scate/";
	var siteroot = "http://www.scate.com/";
	var siteData = [
		["Products", siteroot + "products.html"],
		["->ScateIgnite.com", "http://www.scateignite.com/"],
		["->IgniteCAST.com", "http://www.ignitecast.com/"],
		["->ScreenTweet.com", "http://www.screentweet.com/"],
		["->ScateMVV.com", "http://www.scatemvv.com/"],
		["------------------------------", "#"],
		["Services", siteroot + "services.html"],
		["->App. Development ", siteroot + "services-application-development.html"],
		["->Web Development", siteroot + "services-web-development.html"],
		["->Cloud Computing", siteroot + "services-cloud-computing.html"],		
		["->Graphics Design ", siteroot + "services-graphic-design.html"],
		["->Video Production ", siteroot + "services-video-production.html"],
		["->3D Modeling Animation", siteroot + "services-3d-modeling.html"],
		["->Web Marketing/SEO", siteroot + "services-web-marketing-seo.html"],
		["->Narration/podcasting", siteroot + "services-narration-podcasting.html"],
		["->E-Learning/ISD", siteroot + "services-elearning.html"],
		["------------------------------", "#"],
		["Customers", siteroot + "customers.html"],
		["------------------------------", "#"],
		["Community", siteroot + "community.html"],
		["------------------------------", "#"],
		["Contact Us", siteroot + "contactus.html"],
		["------------------------------", "#"],
		["About Us", siteroot + "about.html"],
		["->News ", siteroot + "news.html"],
		["->Management Team", siteroot + "management.html"],
		["->Maps and Directions ", siteroot + "maps.html"],
		["->Jobs ", siteroot + "jobs.html"],
		["->Patents", siteroot + "patents.html"],
		["->Trademarks", siteroot + "trademarks.html"],
		["->Privacy Policy", siteroot + "privacy.html"],
		["->Terms of Use", siteroot + "termsofuse.html"]
	];

	var store = new Ext.data.SimpleStore({
		fields: ['site', 'url'],
		data : siteData
	});
	var kmap = new Ext.KeyMap("search", {
		key: 13,
		fn: searchFn,
		scope: searchbox
	});
	var searchbox = new Ext.form.ComboBox({
        typeAhead: false,
        loadingText: 'Searching...',
        emptyText: 'Search',
        id: 'search',
        hideTrigger:false,
        triggerClass: 'x-form-search-trigger',
        onTriggerClick: searchFn,
        applyTo: 'search',
        itemSelector: 'div.search-item',
		onSelect: function(){ // override default onSelect to do redirect
            window.location = String.format('http://www.google.com/search?q=+site%3Ascate.com+{0}&btnG=Search/',Ext.getCmp('search').getRawValue());
        }
    });
	function searchFn(){
		window.location = String.format('http://www.google.com/search?q=+site%3Ascate.com+{0}&btnG=Search/',Ext.getCmp('search').getRawValue());
	}
	function go(url){
		window.location = url;
	}
	var combo = new Ext.form.ComboBox({
		store: store,
		displayField:'site',
		typeAhead: true,
		mode: 'local',
		triggerAction: 'all',
		emptyText:'Quick Links...',
		selectOnFocus:true,
		onSelect: function(record){ // override default onSelect to do redirect
            window.location =
            	String.format('{0}', record.data.url);
        }
	});
	if (Ext.get('menu1')){
		Ext.get('menu1').on('click', function(e){
		   go('http://www.scateignite.com');
		});
	}
	if (Ext.get('menu2')){
		Ext.get('menu2').on('click', function(e){
		   go('http://www.scateignite.com');
		});
	}
	if (Ext.get('menu3')){
		Ext.get('menu3').on('click', function(e){
		   searchFn();
		});
	}
	if (Ext.get('menu4')){
		Ext.get('menu4').on('click', function(e){
		   searchFn();
		});
	}
	if (Ext.get('menu5')){
		Ext.get('menu5').on('click', function(e){
		   searchFn();
		});
	}
	if (Ext.get('menu6')){
		Ext.get('menu6').on('click', function(e){
		   searchFn();
		});
	}
	if (Ext.get('menu7')){
		Ext.get('menu7').on('click', function(e){
		   searchFn();
		});
	}
	combo.render('interact');
});
function imageSwap(srcid, img){
	imgsrctmp = document.getElementById(srcid);	
	imgsrctmp.src = img;
}
