﻿/* Queue the Site Load Events
===================================================================================== */
/*addLoadEvent(initFlashBorders);*/
//addLoadEvent(initClearInputs);
addLoadEvent(initFeatProp);
//addLoadEvent(initIframe);

$(function(){
    initClearInputs();
});

/* Form Element Methods
===================================================================================== */
function initClearInputs(){
    $("input.autoClear").each(function(){
            $(this).attr("default",$(this).val());
            $(this).focus(function(){if($(this).val() == $(this).attr("default")) $(this).val("");});
            $(this).blur(function(){if ($(this).val() == "") $(this).val($(this).attr("default"));});
        });
}

if(typeof sIFR == "function") {
    addLoadEvent(initSIFR);
}
  
function initSIFR() {
   	sIFR.bAutoInit = false;
    sIFR.setup();
    sIFR.replaceElement("Large Headers", named({sSelector:".mainCont .Normal h1", sFlashSrc:"/Scripts/SIFR/gillsans.swf", sColor:"#757062", sLinkColor:"#757062", sBgColor:"#FFFFFF",sWmode:"transparent"}));
    sIFR.replaceElement("Small Headers", named({sSelector:".mainCont .Normal h2, .mainCont .News h2, .mainCont .News h1, .mainCont .ContactList h2", sFlashSrc:"/Scripts/SIFR/gillsans.swf", sColor:"#757062", sLinkColor:"#757062", sBgColor:"#FFFFFF",sWmode:"transparent"}));
    sIFR.replaceElement("Contact Headers", named({sSelector:".mainCont .Contact h3", sFlashSrc:"/Scripts/SIFR/gillsans.swf", sFlashVars:"textalign=center",sColor:"#757062", sLinkColor:"#757062", sBgColor:"#FFFFFF",sWmode:"transparent"}));
}

function initHomeFlash() {
	altContent = document.getElementById('homeflash') ;
	altContent.style.display = 'none';
	document.write('<div style="clip: rect(10px, 5px, 10px, 5px)">');
	document.write('<object type="application/x-shockwave-flash" bgcolor="#FFFFFF" data="/home2011.swf" width="759" height="308">') ;
	document.write('<param name="movie" value="/home2011.swf" />') ;
	document.write('<param name="bgcolor" value="#FFFFFF" />') ;
	document.write(altContent.innerHTML) ;
	document.write('</object></div>') ;
}

function initIframe() {
	if (!document.getElementsByTagName("iframe")[0]) return;
	var i = document.getElementsByTagName("iframe")[0];
	// scrolls page to top after iframe loaded
	i.onload = function() { window.scrollTo(0,0); }
}

function initFeatProp() {
	// add pop up handler		
	$("#news a[href^'http://hosting.primelocation.com']").click(
		function() {
			var i = Math.floor(Math.random()*9999)			
			window.open($(this).attr("href"), i, "menubar=0, width=790, height=500, scrollbars=1");
			return false;
		}
	)
}
