tStamp = 'Timestamp 3/3/2009 12:00 PM';


function campaignPhone(pVar){
	var src = readCookie('BBFE');

	pText1 = '(800) 420-5374';
	
	switch(src){

	case 'cake':
		pText1 = '(866) EAT-CAKE';
		alert(tStamp);
	break;
	
	case 'BBDesigner':
		pText1 = '(866) 537-6174';
	break;	
	
	case 'BB4me':
		pText1 = '(866) 537-6175';
	break;
	
	case 'BBforVets':
		pText1 = '(866) 537-6171';
	break;
	
	case 'BB4Vets':
		pText1 = '(866) 537-6170';
	break;
	
	case 'BBforMil':
		pText1 = '(866) 537-6170';
	break;
	
	case 'BBSky':
		pText1 = '(866) 413-2408';
	break;
	
	case 'BBAir':
		pText1 = '(866) 413-2441';
	break;

	case 'BBAndMe':
		pText1 = '(866) 403-8846';
	break;

	case 'BB750':
		pText1 = '(866) 403-8846';
	break;

	case 'HDBusiness':
		pText1 = '(866) 963-8994';
	break;
	
	case 'HDAdfusion':
		pText1 = '(866) 963-8996';
	break;
	
	case 'HDInvestorPPC':
		pText1 = '(866) 963-8994';
	break;
	
	case 'HDVets':
		pText1 = '(866) 963-8991';
	break;
	
	case 'HDVetsMag':
		pText1 = '(866) 963-8991';
	break;
	
	case 'HDBBVets':
		pText1 = '(866) 963-8991';
	break;

	case 'HDMotivate':
		pText1 = '(866) 963-8992';
	break;
	
	case 'HDMotivateInv':
		pText1 = '(866) 963-8993';
	break;
	
	case 'HDDWC':
		pText1 = '(866) 963-8995';
	break;
	
	case 'OneSheeter':
		pText1 = '(866) 250-0445';
	break;
	
	case 'GI':
		pText1 = '(866) 250-0446';
	break;
	
	default:
	break;		
	}
		
	switch(pVar){
		
	case "pText1":
		return(pText1);
	break;
	
	default:
	break;	
	}
	
}

function getContent(){
	if (document.URL.indexOf('open-a-franchise') != -1){
			document.write('<h3><center>Budget Blinds<br> Franchise Opportunity</center></h3><br/><p>Learn more about the Budget Blinds franchise opportunity today!</p><p class="align_center"><a href="/stories/"><img src="/_images/vidthumb.jpg" alt=""></a></p><p><a href="/stories/">Watch The Video!</a></p>');
	}
	if (document.URL.indexOf('choose-budget-blinds') != -1){
			document.write('<h3><center>Budget Blinds<br> Franchise Opportunity</center></h3><br/><p>Learn more about the Budget Blinds franchise opportunity today!</p><p class="align_center"><a href="/stories/"><img src="/_images/vidthumb.jpg" alt=""></a></p><p><a href="/stories/">Watch The Video!</a></p>');
	}
	if (document.URL.indexOf('training-and-support') != -1){
			document.write('<h3><center>Budget Blinds<br> Franchise Opportunity</center></h3><br/><p>Learn more about the Budget Blinds franchise opportunity today!</p><p class="align_center"><a href="/stories/"><img src="/_images/vidthumb.jpg" alt=""></a></p><p><a href="/stories/">Watch The Video!</a></p>');
	}
	if (document.URL.indexOf('faq') != -1){
			document.write('<h3><center>Budget Blinds<br> Franchise Opportunity</center></h3><br/><p>Learn more about the Budget Blinds franchise opportunity today!</p><p class="align_center"><a href="/stories/"><img src="/_images/vidthumb.jpg" alt=""></a></p><p><a href="/stories/">Watch The Video!</a></p>');
	}
	if (document.URL.indexOf('get-started') != -1){
			document.write('<h3><center>Budget Blinds<br> Franchise Opportunity</center></h3><br/><p>Learn more about the Budget Blinds franchise opportunity today!</p><p class="align_center"><a href="/stories/"><img src="/_images/vidthumb.jpg" alt=""></a></p><p><a href="/stories/">Watch The Video!</a></p>');
	}
}


//Check for a query string
if (document.URL.indexOf("?") != -1){
	//Check for and store query string variable "src"
	var source = getQueryVariable("src");
	createCookie('BBFE',source,30);
	var gmsource = getQueryVariable("gmsrc");
	if(gmsource == "" && getDirName().toLowerCase() == "startnow")
		gmsource = "StartNow";
	createCookie('gmHFC',gmsource,30);
}

//Write out campaign variable as a hidden form field
function returnSource(){
	var src = readCookie('BBFE');
	document.write('<input name="src" id="src" type="hidden" value="'+src+'" />')
	var gmsrc = readCookie('gmHFC');
	document.write('<input name="gmsrc" id="gmsrc" type="hidden" value="'+gmsrc+'" />')
}

function getDirName() {
	var retVar = "";
	var dirs=window.location.href.split('/'),
	retVar = dirs[dirs.length-2];
	//alert(retVar);
	return retVar;
}

function getQueryVariable(variable) {
	var retVar = "";
	var query = window.location.search.substring(1);
	var vars = query.split("&");
	for (var i=0;i<vars.length;i++) {
		var pair = vars[i].split("=");
		if (pair[0] == variable) {
			retVar = pair[1];
		}
	}
	return retVar;
}

function createCookie(name,value,days) {
		if (days) {
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
}

function readCookie(name) {
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}

function eraseCookie(name) {
	createCookie('BBFE',"",-1);
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////


function validate(){
	document.write('<ul>');
	document.write('<li><a href="http://validator.w3.org/check/referer" onclick="return !window.open(this.href);">XHTML 1.1</a></li>');
	document.write('<li><a href="http://jigsaw.w3.org/css-validator/check/referer" onclick="return !window.open(this.href);">CSS</a></li>');
		document.write('<li><a href="http://creativecommons.org/licenses/by-nc-nd/2.5/" onclick="return !window.open(this.href);">CCL</a></li>');

	document.write('<li><a href="http://www.cynthiasays.com/mynewtester/cynthia.exe?Url1='+document.URL+'&amp;rptmode=2" onclick="return !window.open(this.href)">508</a></li>');
	document.write('<li><a href="http://www.cynthiasays.com/mynewtester/cynthia.exe?Url1='+document.URL+'&amp;rptmode=1" onclick="return !window.open(this.href)">WAI / WCAG</a></li>');
	document.write('</ul>');
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function readout(){
	document.write('Text Size : ');
	document.write('<span><a href="#" onclick="setActiveStyleSheet(\'master\'); return false;">Normal</a></span> ');
	document.write('<span><a href="#" onclick="setActiveStyleSheet(\'alt\'); return false;">Large</a></span>');
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function email(){
document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="245" height="14" id="swf_email" align="middle" title="webmaster at homefranchiseconcepts.com>');
document.write('<param name="allowScriptAccess" value="sameDomain" />');
document.write('<param name="movie" value="swf_email.swf" />');
document.write('<param name="quality" value="high" />');
document.write('<param name="bgcolor" value="#ffffff" />');
document.write('<embed src="swf_email.swf" quality="high" bgcolor="#ffffff" width="245" height="14" name="swf_email" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />');
document.write('</object>');
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function findObj(n, d) {
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}
function validateForm() {
	var i,p,q,nm,prntNm,test,num,min,max,testr,errors='',args=validateForm.arguments;
	for (i=0; i < (args.length-2); i += 3) {	//	Loop through every third value in the args		:BP
		test = args[i+2];						//	Set a var = the third arg						:BP
		fld = findObj(args[i]);				//	Get the object with the arg name				:BP
		if (fld) {
			nm = fld.name;
			prntNm = args[i+1];					//	Set a var = the second arg name, I added this as the printable Name		:BP
			if (prntNm == "")	prntNm = nm;	//	Set printable name to arg Name if not provided
			if ((val = fld.value) != "") {
				if (test.indexOf('isEmail') != -1) {
					p = val.indexOf('@');
					if (p < 1 || p == (val.length - 1))
						errors += '- ' + prntNm + ' must contain an e-mail address.\n';
				} else if (test.indexOf('cPass') != -1) {
					p = test.indexOf(':');
					testr = test.substring(p+1);
					val2 = findObj(testr);
					if (val != val2.value)
						errors += '- Password fields do not match.\n';
				} else if (test == 'C') {
					if (fld.checked != true) errors += '- ' + prntNm + '\n';
				} else if (test != 'R') {
					num = parseFloat(val);
					if (isNaN(val)) errors += '- ' + prntNm + ' must contain a number.\n';
					if (test.indexOf('inRange') != -1) {
						p = test.indexOf(':');
						min = test.substring(8,p);
						max = test.substring(p+1);
						if (num < min || max < num)
							errors += '- ' + prntNm + ' must contain a number between ' + min + ' and ' + max + '.\n';
					}
				}
			} else if (test.charAt(0) == 'R') errors += '- ' + prntNm + ' is required.\n';
		}
	}
	if (errors)
		alert('The following information is required:\n' + errors);
	document.MM_returnValue = (errors == '');
}
function popAnyHelp(strURL, strWinName, strParams) {
	var winRUHelp = window.open(strURL, strWinName, strParams);
	if(!winRUHelp) {
		alert("This HFC site has detected that you are using a popup blocker.\nPlease add this site to your trusted sites list or disable your popup blocker.\n\nThank you.");
	}
	winRUHelp.focus();
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//function setActiveStyleSheet(title) {
//  var i, a, main;
//  for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
//    if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title")) {
//      a.disabled = true;
//      if(a.getAttribute("title") == title) a.disabled = false;
//    }
//  }
//}

function getActiveStyleSheet() {
  var i, a;
  for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
    if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title") && !a.disabled) return a.getAttribute("title");
  }
  return null;
}

function getPreferredStyleSheet() {
  var i, a;
  for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
    if(a.getAttribute("rel").indexOf("style") != -1
       && a.getAttribute("rel").indexOf("alt") == -1
       && a.getAttribute("title")
       ) return a.getAttribute("title");
  }
  return null;
}

function createCookie(name,value,days) {
  if (days) {
    var date = new Date();
    date.setTime(date.getTime()+(days*24*60*60*1000));
    var expires = "; expires="+date.toGMTString();
  }
  else expires = "";
  document.cookie = name+"="+value+expires+"; path=/";
}

function readCookie(name) {
  var nameEQ = name + "=";
  var ca = document.cookie.split(';');
  for(var i=0;i < ca.length;i++) {
    var c = ca[i];
    while (c.charAt(0)==' ') c = c.substring(1,c.length);
    if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
  }
  return null;
}

window.onload = function(e) {
  var cookie = readCookie("style");
  var title = cookie ? cookie : getPreferredStyleSheet();
  setActiveStyleSheet(title);
}

window.onunload = function(e) {
  var title = getActiveStyleSheet();
  createCookie("style", title, 365);
}

var cookie = readCookie("style");
var title = cookie ? cookie : getPreferredStyleSheet();
setActiveStyleSheet(title);

