function setStyle() {
	var style = readCookie("page_style");
	if (style != null) {
		setActiveStyleSheet(style, 0);
	}
}

function setActiveStyleSheet(title, reset) {
	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;
		}
	}
	if (reset == 1) {
		createCookie("page_style", title, 365);
	}
}

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+";domain=.maxorspecialty.com;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 displayFeaturePhoto()
{
	//////// Claim Some Space for Variables ////////
	var nProd; //local variable to hold a randomly generated value
	var iProd; //local dumb variable for loops
	var ProductInserts; //initializes a new local array to hold the file names for the include files
	//////// Use Up System Memory ////////
	ProductInserts = new Array(); //allocates memory to the new includes string array 
	//////// Working Code Area ////////
	//////// Start Doing the Math ////////
	nProd = (Math.round(Math.random() * 9)); //assigns a random number to the 'nProd' variable
	ProductInserts[0] = "<img src='images/feature_photo_01.jpg' width='200' height='326' border='0' class='featurephoto' align='left' alt='Feature Photo' />";
	ProductInserts[1] = "<img src='images/feature_photo_02.jpg' width='200' height='326' border='0' class='featurephoto' align='left' alt='Feature Photo' />";
	ProductInserts[2] = "<img src='images/feature_photo_03.jpg' width='200' height='326' border='0' class='featurephoto' align='left' alt='Feature Photo' />";
	ProductInserts[3] = "<img src='images/feature_photo_04.jpg' width='200' height='326' border='0' class='featurephoto' align='left' alt='Feature Photo' />";
	ProductInserts[4] = "<img src='images/feature_photo_05.jpg' width='200' height='326' border='0' class='featurephoto' align='left' alt='Feature Photo' />";
	ProductInserts[5] = "<img src='images/feature_photo_06.jpg' width='200' height='326' border='0' class='featurephoto' align='left' alt='Feature Photo' />";
	ProductInserts[6] = "<img src='images/feature_photo_07.jpg' width='200' height='326' border='0' class='featurephoto' align='left' alt='Feature Photo' />";
	ProductInserts[7] = "<img src='images/feature_photo_08.jpg' width='200' height='326' border='0' class='featurephoto' align='left' alt='Feature Photo' />";
	ProductInserts[8] = "<img src='images/feature_photo_09.jpg' width='200' height='326' border='0' class='featurephoto' align='left' alt='Feature Photo' />";
	ProductInserts[9] = "<img src='images/feature_photo_10.jpg' width='200' height='326' border='0' class='featurephoto' align='left' alt='Feature Photo' />";
	document.write(ProductInserts[nProd]);
}

setStyle();