
function initRollovers() {
	if (!document.getElementById) return
	
	var aPreLoad = new Array();
	var sTempSrc;
	var aImages = document.getElementsByTagName('img');

	for (var i = 0; i < aImages.length; i++) {		
		if (aImages[i].className == 'imgover') {
			var src = aImages[i].getAttribute('src');
			var ftype = src.substring(src.lastIndexOf('.'), src.length);
			var hsrc = src.replace(ftype, '_o'+ftype);

			aImages[i].setAttribute('hsrc', hsrc);
			
			aPreLoad[i] = new Image();
			aPreLoad[i].src = hsrc;
			
			aImages[i].onmouseover = function() {
				sTempSrc = this.getAttribute('src');
				this.setAttribute('src', this.getAttribute('hsrc'));
			}	
			
			aImages[i].onmouseout = function() {
				if (!sTempSrc) sTempSrc = this.getAttribute('src').replace('_o'+ftype, ftype);
				this.setAttribute('src', sTempSrc);
			}
		}
	}
}




/* modified to show some better options for searching on my site from google */
/* based on http://www.kryogenix.org/code/browser/searchhi/ */
/* Modified 20021006 to fix query string parsing and add case insensitivity */

function googleFindSearch() {
	if (!document.createElement) return;
	ref = document.referrer;
	
	//alert('ref = ' + ref.indexOf('SearchView.aspx'));
	
	// if the referrer has URL params or it is is my own site
	if (ref.indexOf('?') == -1 || ref.indexOf('http://www.jforsythe.com/jforsytheblog/') != -1)
	{
		
		// if this page is my own search page executing, snuff out the script
		
		//if (document.location.href.indexOf('PermaLink') != -1) {
		//if (ref.indexOf('SearchView.aspx') == -1) { 
		if (document.location.href.indexOf('SearchView.aspx') != -1) {
		
			return;
		//} 
		} else {
			
		// if there are actually no params on this page.
		
		//Added by Scott Hanselman
		ref = document.location.href;
		if (ref.indexOf('?') == -1) {
			return;
		}
		}
		
	}
	
    // this page has params
	qs = ref.substr(ref.indexOf('?')+1);
	qsa = qs.split('&');
	
	for (i=0;i<qsa.length;i++) {
		qsip = qsa[i].split('=');
	        if (qsip.length == 1) continue;
        	if (qsip[0] == 'q' || qsip[0] == 'p' || qsip[0] == 'as_q') { // q= for Google, p= for Yahoo, as_q = google 'advanced search pages'
			words = unescape(qsip[1].replace(/\+/g,' ')).split(/\s+/);
			        wordqueue = '';
	                for (w=0;w<words.length;w++) {
						
						if ((words[w].indexOf('site:jforsythe') != -1)) {
							//google advanced option
						} else if ((words[w].indexOf('blogurl:jforsythe') != -1)) {
						    // google blog search advanced search 1st page
							 
						} else if (words[w] == '1') {
							
						} else if (words[w] == '2') {
							
						} else if (words[w] == '3') {
							
						} else if (words[w] == '4') {
							
						} else if (words[w] == '5') {
							
						} else if (words[w] == '6') {
							
						} else if (words[w] == '7') {
							
						} else if (words[w] == '8') {
							
						} else if (words[w] == '9') {
							
						} else if (words[w] == '0') {
							
						} else {
							wordqueue += words[w] + ' ';
						}
						
						// highlightWord(document.getElementsByTagName("body")[0],words[w]);
						
                	}
					
						if(ref.indexOf('blogsearch.google.com') != -1) {
							document.getElementById('searchlocation').innerHTML = '<h2>Hello Blogsearch user</h2>';
						} else if(ref.indexOf('google.com') != -1) {
							document.getElementById('searchlocation').innerHTML = '<h2>Hello Google user</h2>';
						} else if(ref.indexOf('search.blogger.com') != -1) {
							document.getElementById('searchlocation').innerHTML = '<h2>Hello Blogger user</h2>';
						} else if(ref.indexOf('yahoo.com') != -1) {
							document.getElementById('searchlocation').innerHTML = '<h2>Hello Yahoo! user</h2>';
						} else { 
						    document.getElementById('searchlocation').innerHTML = '<h2>Hello Web user</h2>';
						}
					
					document.getElementById('searchengine').style.display = 'block';
					document.getElementById('searchphrase').innerHTML = '<a href="http://www.jforsythe.com/jforsytheblog/SearchView.aspx?q=' + wordqueue + '">' + wordqueue + '</a>';
	        }
			
	}
	//alert('finished');
}




//window.onload = initRollovers;
