var infinity = new infinityScripts();
	            
function infinityScripts() {

	this.locatorSearch = function(region) {
		window.location = '?page=view-retailers&region=' + region;
	};

	//sel - select list containing options text/value of State/ST
	this.detectRegion = function(sel) {
		try {
			if (google.loader.ClientLocation 
			&& google.loader.ClientLocation.address 
			&& google.loader.ClientLocation.address.country_code == "US"		
			&& google.loader.ClientLocation.address.region
			) {
				var region = google.loader.ClientLocation.address.region;
				for (var i=0;i<sel.options.length;i++) {
					if (sel.options[i].value==region) {
						return sel.options[i].innerHTML;					
					};			
				};		
			} else {
				return '';
			};
		} catch (e) {
			return '';
		};
	};
				
	/* swfobject */
	var playerVersion = "6";
	this.playMovie = function(target, videoURL, autoPlay, loop, color, width, height, playerURL) {

		/*
			Other browsers still see/respond to the div's onclick event.
			Guessing if the flash itself were set 'transparent', IE would do the same
		*/
		document.getElementById(target).onclick = "";
		
		document.getElementById(target).style.backgroundImage="none";
		if (color!=null) {
			document.getElementById(target).style.backgroundColor=color;
		};
		
		if (!playerURL) {
			playerURL = "flash/VideoViewer583.swf";
		};
		var so= new SWFObject(playerURL, target + "-movie", width, height, playerVersion);
		so.addParam("flashvars", "videoURL=" + videoURL + "&videoAutoPlay=" + autoPlay + "&videoLoop=" + loop);
		so.addParam("wmode", "transparent");
		so.addParam("menu", "true");
		so.addParam("play", "true");
		so.addParam("viewastext", "VIEWASTEXT");
		so.addParam("allowscriptaccess", "sameDomain");
		so.write(target);

	};
	this.loadFlash = function(target, swfURL, color, width, height) {

		document.getElementById(target).style.backgroundImage="none";
		if (color!=null) {
			document.getElementById(target).style.backgroundColor=color;
		};

		var so= new SWFObject(swfURL, null, width, height, playerVersion);
		so.addParam("wmode", "transparent");
		so.write(target);

	};
	/*-- swfobject */

};

//hover effect - swap the src of two images contained in an anchor tag
//refer to ascx's using this function
function swapImage(anchor) {
	var img = anchor.getElementsByTagName("img");
	//don't bother to try swapping if there are more or less than two images - somethings obviously horribly wrong
	if (img.length == 2) {
		var tmp=img[0].src;
		img[0].src=img[1].src;
		img[1].src=tmp;
	}
}

function showbox() {
	document.getElementById('change').style.display = 'block';
	document.getElementById('current_location').style.display = 'none';
}
function expandRequestForm()
{
	document.getElementById('global-request-form').style.width = '935px';
	document.getElementById('global-request-dynaform').style.width = '935px';
}
function collapseRequestForm()
{
	document.getElementById('global-request-form').style.width = '165px';
	document.getElementById('global-request-dynaform').style.width = '165px';
}