// JavaScript Document

addLoadEvent(blurLinks);
addLoadEvent(correctPNG);
addLoadEvent(embedVideo);


function addLoadEvent(func) {
	var oldonload = window.onload;
	if (typeof window.onload != 'function') {
		window.onload = func;
	}
	else {
		window.onload = function() {
			oldonload();
			func();
		}
	}
}



/* remove all focus lines from links when clicked */
function blurLinks() {
	var links = document.getElementsByTagName('a');
	for (i=0;i<links.length;i++) {
		links[i].onfocus = function() {
			this.blur();
		}
	}
}




function embedVideo() {
	new flashembed("video-blank-inner_", { 
		src: "assets/video/FlowPlayerLight.swf", width: 500, height: 250 }, {
			config: {
				bgcolor: '#000000',
				autoPlay: true,
				autoRewind: true,
				showStopButton: false, 
				showScrubber: false, 
				showVolumeSlider: false,
				showMuteVolumeButton: false, 
				showFullScreenButton: false, 
				showMenu: false, 
				controlsOverVideo: 'locked',
				controlBarBackgroundColor: -1,
				controlBarGloss: 'none',
				bufferLength:15,
				startingBufferLength:5,
				initialScale: 'scale',
				videoFile: 'Roddick-shoes.flv',
				loop:false
			} 
		}
	);
}




function correctPNG(){ // correctly handle PNG transparency in Win IE 5.5 & 6.


   var arVersion = navigator.appVersion.split("MSIE")
   var version = parseFloat(arVersion[1])
   if ((version >= 5.5) && (document.body.filters)) 
   {
      for(var i=0; i<document.images.length; i++)
      {
         var img = document.images[i]
         var imgName = img.src.toUpperCase()
         if (imgName.substring(imgName.length-3, imgName.length) == "PNG")
         {
            var imgID = (img.id) ? "id='" + img.id + "' " : ""
            var imgClass = (img.className) ? "class='" + img.className + "' " : ""
            var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' "
            var imgStyle = "display:inline-block;" + img.style.cssText 
            if (img.align == "left") imgStyle = "float:left;" + imgStyle
            if (img.align == "right") imgStyle = "float:right;" + imgStyle
            if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle
            var strNewHTML = "<span " + imgID + imgClass + imgTitle
            + " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";"
            + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
            + "(src=\'" + img.src + "\', sizingMethod='scale');\"></span>" 
            img.outerHTML = strNewHTML
            i = i-1
         }
      }
   }    
}


function openWindow(URL, intWidth, intHeight) {
		var left = ((parseInt(screen.availWidth)/2)-(intWidth/2));
		var top = ((parseInt(screen.availHeight)/2)-(intHeight/2));

		newWindow = window.open(URL, "loading", "toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,width="+intWidth+",height="+intHeight+",left="+left+",top="+top+"")
		newWindow.focus();
}



function scrollToResult() {
	Effect.ScrollTo('systemResponse', { queue: 'front' });
	Effect.Pulsate('resultFlash', { pulses: 5, duration: 1.5, queue: 'end' });
}

function googleConversion() {
	var google_conversion_id = 1026061169;
	var google_conversion_language = "en";
	var google_conversion_format = "3";
	var google_conversion_color = "0e81a6";
	var google_conversion_label = "ntK7CKGPtgEQ8eah6QM";
	var google_conversion_value = 0;
	
	print ('<script type="text/javascript" src="http://www.googleadservices.com/pagead/conversion.js"></script>');
}


