// JavaScript Document

function getEntryURL(catalog){
    hostname = "http://v2.recognitionexpress.com"

    if (window.location.hostname == "staging.ncaor.recognitionexpress.com") {
        hostname = "http://staging.v2.recognitionexpress.com/ncaor"
    }

    if (window.location.hostname == "ncaor.recognitionexpress.com") {
        hostname = "http://v2.recognitionexpress.com/ncaor"
    }

	if (catalog == ""){
		alert("Please select a catalog from the list.");
	}/*else if (catalog == "Century21(BA)"){
		//Remove comment (line below) when store fronts for franchises are ready.
		//jQuery.facebox({ ajax: 'zipsearch.html' })
		//Comment out (line below) when store fronts from franchises are ready.
		window.location = "http://www1.recognitionexpresslv.com/bin/relvorder.cgi?Brand=BA"
	}*/else{
        window.location= hostname + "/control/main?CURRENT_CATALOG_ID=" + catalog + "";
    }
}


function getFullURL(){
	hostname = "http://v2.recognitionexpress.com/control/main?CURRENT_CATALOG_ID=defaultcatalog"

    if (window.location.hostname == "staging.ncaor.recognitionexpress.com") {
        hostname = "http://staging.v2.recognitionexpress.com/ncaor"
    }

    if (window.location.hostname == "ncaor.recognitionexpress.com") {
        hostname = "http://v2.recognitionexpress.com/ncaor/control/main?CURRENT_CATALOG_ID=norcar"
    }
var myString = "" + hostname + "";
window.location = myString;
}

function generalCatalog(){
	if (window.location.hostname == "ncaor.recognitionexpress.com") {
		document.write('<img src="graphics/index_graphics/b2-ncaor-section.jpg" alt="We have over 38 years of experience in creating professional, high quality name tags that are tailored to your specific needs. In addition to name tags, we also offer a wide selection of customized products&#8212;so whatever your needs, contact Recognition Express for a professional commitment to quality that you can count on." width="287" height="60">');
	}else {
		document.write('<img src="graphics/index_graphics/b2-other-industries-section.jpg" alt="We have over 38 years of experience in creating professional, high quality name tags that are tailored to your specific needs. In addition to name tags, we also offer a wide selection of customized products&#8212;so whatever your needs, contact Recognition Express for a professional commitment to quality that you can count on." width="287" height="60">');
	}
}

function getSpecificURL(catalog) {
	var myString = "" + catalog + "";
	window.location = myString;
}


    //Add links to franchise store fronts (lines below) when store fronts from franchises are ready.
	var svSite="http://www.usatoday.com"; //Spring Valley Branch
	var smSite="http://www.cnn.com";  //San Mateo Branch
	var txSite="http://www.msnbc.com";  //Texas Branch
	var normSite= hostname + "/control/main?CURRENT_CATALOG_ID=defaultcatalog";

function zipCheck(){
	var SVzipLoc=["99701","99801","99705","92805","92807","90706","90620","90621","92008","90703","90703","90703","91914","91765","90241","90240","90241","90241","90242","90241","92019","92020","92243","92024","92025","92833","92835","92833","92832","92841","91745","91745","92646","92648","90255","92604","90631","90631","91942","90638","92637","90712","90806","90745","90807","90720","90640","90640","90650","92054","90660","92870","91768","92065","92688","92672","92101","92108","92129","92117","92127","92108","92109","92110","92122","92107","92103","92116","92704","92706","92701","90740","90280","92084","91789","91788","91791","92683","92683","90604","92886","96701","96720","96720","96825","96814","96826","96815","96815","96814","96826","96732","96734","96740","96740","96740","96744","96746","96756","96761","96789","96722","96797","96738","96753","96797"];
	var SMzipLoc=["95003","95223","93422","93422","93604","94710","95006","93428","93614","94521","95228","95014","94014","94015","95620","94568","94303","95624","94533","94539","94538","94538","93711","93711","94019","93230","94541","94541","94547","95642","93285","93635","93546","95338","95340","95035","95350","93940","95247","94558","94559","94560","95361","95361","93644","93644","94602","94612","94952","94564","93257","94062","94806","94571","94928","93901","93906","93906","94112","94121","94127","95124","95100","95148","95118","95138","95121","95118","95121","95118","95112","94402","94901","94583","93657","95051","95060","95409","95404","95404","95066","93664","95476","95207","94087","93271","93274","95383","94587","95687","94591","95252","95252","93277","93277","95076"];
	var TXzipLoc=["71923","72501","72714","72015","72315","72022","72023","71701","72830","72032","72034","71730","72632","72088","72701","72542","72601","72543","71909","72076","72401","71953","72653","72653","72560","72949","72450","72855","72753","72758","72801","72761","71301","71220","71112","71111","70345","70634","70535","71241","70354","70358","70358","70058","70360","70065","70506","70601","70601","70068","71446","70471","70471","71449","70005","71055","71201","70380","70127","70570","71360","71270","71118","71105","70461","70301","71291","73521","73401","74006","74834","73018","74017","74429","74023","73034","73701","74434","74344","73045","73439","73507","74352","74501","73130","73110","73160","74403","73069","73139","73159","73112","74447","74604","74953","74361","74955","74801","74804","74075","74464","74301","74467","75410","78332","79109","79106","76013","75751","78759","78746","78745","78731","78727","76020","77521","78006","75418","79007","77422","77833","76426","78521","78521","76354","76028","78611","75006","75633","75104","75935","79201","77840","76034","76233","75428","77304","75432","76522","76522","78418","78414","78413","78410","75110","75114","77532","76036","77429","77429","75638","75200","75247","75208","78840","76210","78852","75440","75119","75022","75126","79735","76133","76133","76179","76109","78624","77546","75034","76240","77554","75043","78626","76043","76044","76048","76049","75052","76051","75401","75402","76642","75156","75650","78550","75765","75654","79045","76645","78657","77053","77089","77084","77015","77070","77036","77024","77009","77002","77017","77062","77338","77325","77346","75766","75951","75657","78636","76247","77450","76248","78028","76543","76542","78639","78363","78945","78121","77566","76106","78040","77573","77573","75771","78643","75604","75605","79414","75901","77657","77354","76063","78654","75670","75670","78504","75071","75150","75150","76667","79703","75773","76067","75455","75457","75570","76180","79761","75801","79065","75462","75460","77581","79070","75686","75093","75075","78064","78374","75076","75474","75783","78664","75189","76179","76571","76904","78230","78213","78251","78216","78217","78233","78666","76266","78956","77474","75090","75090","78597","76092","77386","77379","76082","76401","77478","75482","75482","75182","78643","76501","76504","75160","75503","77380","77375","75703","75701","78148","77903","76710","77484","75165","76086","75791","76273","76308","76087","75169","78676","75098","75497"];
	var chosenZip = document.zipSearch.searchbox.value;
	//alert(chosenZip);
	if (SVzipLoc.indexOf(chosenZip) != -1){
			//alert("Spring Valley Customer!");
			window.location = svSite;
			}else if (SMzipLoc.indexOf(chosenZip) != -1){
			//alert("San Mateo Customer!");
			window.location = smSite;
			}else if (TXzipLoc.indexOf(chosenZip) != -1){
			//alert("Texas Customer!");
			window.location = txSite;
			}else{
			//alert("This is not a franchise location. Forwarding to default catalog.");
			window.location = normSite;
			//Replace with actual home page URL if altered.
			}
	}
	
	function cancelBox(){
		jQuery(document).trigger('close.facebox');
	}
	

