
function newImage(arg) {
	if (document.images) {
		rslt = new Image();
		rslt.src = arg;
		return rslt;
	}
}

function changeImages() {
	if (document.images && (preloadFlag == true)) {
		for (var i=0; i<changeImages.arguments.length; i+=2) {
			document[changeImages.arguments[i]].src = changeImages.arguments[i+1];
		}
	}
}

var preloadFlag = true;
function preloadImages() {
	if (document.images) {
		AlreadyInFranchising_over = newImage("images/PageNav/AlreadyInFranchising-over.gif");
		LookingForAFranchise_over = newImage("images/PageNav/LookingForAFranchise-over.gif");
		SearchFranchiseOpportunities_over = newImage("images/PageNav/SearchFranchiseOpportuni-10.gif");
		preloadFlag = true;
	}
}


function newImage(arg) {
	if (document.images) {
		rslt = new Image();
		rslt.src = arg;
		return rslt;
	}
}

function changeImages() {
	if (document.images && (preloadFlag == true)) {
		for (var i=0; i<changeImages.arguments.length; i+=2) {
			document[changeImages.arguments[i]].src = changeImages.arguments[i+1];
		}
	}
}

var preloadFlag = false;
function preloadImages() {
	if (document.images) {
		DisclosureGuide_over = newImage("images/PageNav/DisclosureGuide-over.jpg");
		DisclosureCommentary_over = newImage("images/PageNav/DisclosureCommentary-over.jpg");
		preloadFlag = true;
	}
}


function newImage(arg) {
	if (document.images) {
		rslt = new Image();
		rslt.src = arg;
		return rslt;
	}
}

function changeImages() {
	if (document.images && (preloadFlag == true)) {
		for (var i=0; i<changeImages.arguments.length; i+=2) {
			document[changeImages.arguments[i]].src = changeImages.arguments[i+1];
		}
	}
}

var preloadFlag = false;
function preloadImages() {
	if (document.images) {
		ByCategory_over = newImage("images/PageNav/ByCategory-over.jpg");
		AlphabeticalIndex_over = newImage("images/PageNav/AlphabeticalIndex-over.jpg");
		preloadFlag = true;
	}
}

function newImage(arg) {
	if (document.images) {
		rslt = new Image();
		rslt.src = arg;
		return rslt;
	}
}

function changeImages() {
	if (document.images && (preloadFlag == true)) {
		for (var i=0; i<changeImages.arguments.length; i+=2) {
			document[changeImages.arguments[i]].src = changeImages.arguments[i+1];
		}
	}
}

var preloadFlag = false;
function preloadImages() {
	if (document.images) {
		Franchisors_over = newImage("images/PageNav/Franchisors-over.jpg");
		SupportServices_over = newImage("images/PageNav/SupportServices-over.jpg");
		CodeOfEthics_over = newImage("images/PageNav/CodeOfEthics-over.jpg");
		preloadFlag = true;
	}
}




	function makeArray(n) {
	this.length = n;
	return this;
	}
	monthNames = new makeArray(12);
	monthNames[1] = "January";
	monthNames[2] = "February";
	monthNames[3] = "March";
	monthNames[4] = "April";
	monthNames[5] = "May";
	monthNames[6] = "June";
	monthNames[7] = "July";
	monthNames[8] = "August";
	monthNames[9] = "September";
	monthNames[10] = "October";
	monthNames[11] = "November";
	monthNames[12] = "December";
	function dateString(oneDate) {
	var theMonth = monthNames[oneDate.getMonth() + 1];
	var theYear = oneDate.getFullYear();
	return theMonth + " " + oneDate.getDate() + ", " + theYear;
	}

	function printWindow() {
	bV = parseInt(navigator.appVersion);
	if (bV >= 4) window.print();
	}

 function SearchFranchise(varHTM){
        var path;
        
        if (varHTM =='HTM')
        {
            path = '';        
        }
        else
        {
            path='../';
        }
        
        if(document.forms[0].txtSearch.value=='') // && document.forms[0].radCategory.checked==false && document.forms[0].radAlpha.checked==false)
        {
            alert('Please enter name'); //specify at least one search criteria.');
            
        }
        else 
        {
		document.location = path+'FranchiseDetail.aspx?item='+document.forms[0].txtSearch.value;

//			if (document.forms[0].radCategory.checked==true){
//				if (document.forms[0].txtSearch.value==''){
//					document.location = path+'MemberCategories.aspx';
//				}
//				else{
//					document.location = path+'FranchiseDetail.aspx?categoryname='+document.forms[0].txtSearch.value;
//				}
//			}
//			else{
//				if (document.forms[0].radAlpha.checked==true){
//					if (document.forms[0].txtSearch.value==''){
//						document.location = path+'MemberListing.aspx';
//					}
//					else{
//						document.location = path+'FranchiseDetail.aspx?item='+document.forms[0].txtSearch.value;
//					}				
//				}
//			}
			
        }
    }


	
	
	function Banner(refreshTime, width, height, altText, start, random){
	this.objName = "bannerAd" + (Banner.count++);
	eval(this.objName + "=this");
	if (!refreshTime) this.refreshTime = 5000; else this.refreshTime = refreshTime*1000;
	if (!width) this.width = 460; else this.width = width;
	if (!height) this.height = 68; else this.height = height;
	if (random == null) this.random = 1; else this.random = random;
	this.altText = altText;
	this.ads = [];
	if (start) this.currentAd = start-1; else start = null;
	this.mySize = 0;

	this.Ad = function(src, href, target, mouseover,folder) {
		var tempImage = new Image();
		if (folder==1){tempImage.src = src;}else{tempImage.src = "./CFA_HTM/"+src;}
				
		this.ads[this.mySize] = new Object();
		var ad = this.ads[this.mySize];
		
		if (folder==1) {ad.src = src;} else {ad.src = "./CFA_HTM/"+src;}
		
		if (typeof(target) == "undefined" || target == null) ad.target = "_self"; else ad.target = target;
		ad.href = href;
		ad.mouseover = mouseover;
		this.mySize++;
	}

	this.link = function(){
		var	ad = this.ads[this.currentAd];
		if (ad.target == "_self"){
			location.href = ad.href;
		}
		else if (ad.target == "_blank" || ad.target == "_new"){
			open(ad.href,this.objName + "Win");
		}
		else top.frames[ad.target].location.href = ad.href;
	}

	this.showStatus = function(){
		var ad = this.ads[this.currentAd];
		if (ad.mouseover) status = ad.mouseover;
		else status = ad.href;
	}

	this.randomAd = function(){
		var n;
		do { n = Math.floor(Math.random() * (this.mySize)); } 
		while(n == this.currentAd);
		this.currentAd = n;
	}

	this.output = function(){
		var tempCode = "";
		if (this.mySize > 1){
			if (this.currentAd == null) this.randomAd();
			if (this.currentAd >= this.mySize) this.currentAd = this.mySize - 1;
			tempCode = '<a href="javascript:'+this.objName+'.link();"';
			tempCode += ' onMouseOver="' + this.objName + '.showStatus(); return true"';
			tempCode += ' onMouseOut="status=\'\';return true">';
			tempCode += '<img src="' + this.ads[this.currentAd].src + '" width="' + this.width;
			tempCode += '" name="' + this.objName + 'Img" height="' + this.height + '" ';
			if (this.altText) tempCode += 'alt="'+this.altText + '" ';
			tempCode += 'border="0" usemap="#map"></a>';
			document.write(tempCode);
			this.nextAd();
		} else document.write("Error: two banners must be defined for the script to work.");
	}

	this.newAd = function(){
		if (!this.random){	
			this.currentAd++;
			if (this.currentAd >= this.mySize)
			   this.currentAd = 0;
		}
		else {
			this.randomAd();
		}
		this.nextAd();
	}

	this.nextAd = function(){
		document.images[this.objName+ 'Img'].src = this.ads[this.currentAd].src;
		setTimeout(this.objName+'.newAd()',this.refreshTime)
	}
}
Banner.count = 0;