
window.name = "BLUEmagWindow";
browser = navigator.appName;
version = parseInt(navigator.appversion)
os = navigator.platform;
ie = "Microsoft Internet Explorer";
netscape = "Netscape";
mac = "MacPPC";
	
	
	
if (document.all) //IE4,5
 document.write('\<link rel=\"stylesheet\" href=../Templates/main_files/%5C%22blue_ie.css%5C%22%5C>');
else if (document.layers) //NS4
document.write('\<link rel=\"stylesheet\" href=../Templates/main_files/%5C%22blue_nn.css%5C%22%5C>');
else if (document.getElementById) //NS5
 document.write('\<link rel=\"stylesheet\" href=../Templates/main_files/%5C%22blue_nn.css%5C%22%5C>');
else //NS2,IE3
document.write('\<link rel=\"stylesheet\" href=../Templates/main_files/%5C%22blue_ie.css%5C%22%5C>');
	

			
		
// NS4Bug Fix 					
NS4 = document.layers;
if (NS4) {
	origWidth = innerWidth;
	origHeight = innerHeight;
}
		
function reDo() {
if (innerWidth != origWidth || innerHeight != origHeight)
	location.reload();
}

if (NS4) onresize = reDo;		


function openWindow(pPageName,pAvailResize,pWidth,pHeight,pTop,pLeft) {
//To call this function, pass it a page name in single quote 'index.cfm' - note:
//by default the file is in the /sidebars directory.  use ../ if it should be in the root
//then pass it a yes/no in single quotes for resize.  Then the width, height, top, and left parameters.
//Any number of parameters can be left off the end.  If you need to specify a single paramter

	//set defaults
	var vAvailResize = "yes";
	var vWidth = 600;
	var vHeight = 500;
	var vLeft = 100;
	var vTop = 100;

	//Reset values based on parameters passed in
	if (pAvailResize != null && pAvailResize !='') vAvailResize = pAvailResize;		
	if (pWidth != null && pWidth >0) vWidth = pWidth;		
	if (pHeight != null && pHeight >0) vHeight = pHeight;
	if (pLeft != null && pTop >0) vLeft = pLeft;		
	if (pTop != null && pLeft >0) vTop = pTop;

	window.open(pPageName, 'MBAWindow', 'toolbar=no,location=no,scrollbars=yes,resizable='+vAvailResize+',width='+vWidth+',height='+vHeight+',left='+vLeft+'top='+vTop);
}

function openAd(pPageName,pWidth,pHeight,pTop,pLeft) {

	window.open(pPageName, 'popup', 'toolbar=no,location=no,scrollbars=no,resizable=no,width='+pWidth+',height='+pHeight+',left='+pLeft+'top='+pTop);
}

					
//This function can be called by a drop down to automatically jump to a new URL
//when a new selection is made.
function gotosite(site) {            
        if (site != "") {                    
                self.location=site; 
        }
 }		

//This function is used for rollovers - or for any image replacements
// IMAGE SWAP 
function imgSwap(daImage, daSrc){
	    daImage.src = daSrc;
	}
	
	
//Randomly select one of the banner images that appears in the middle of the page
function randomMagCover(){
		magItems = new Array("images/cover22.jpg","images/cover11.jpg","images/cover6.jpg","images/cover14.jpg","images/cover17.jpg","images/cover21.jpg","images/cover7.jpg","images/cover1.jpg","images/cover8.jpg","images/cover19.jpg","images/cover2.jpg","images/cover9.jpg","images/cover16.jpg","images/cover13.jpg","images/cover12.jpg");
		numImages = magItems.length-1;
		
		//numPromotions = 21;
		randomNum = Math.floor((Math.random() * numImages))+1;
		
		document.magCover.src = magItems[randomNum];
		//document.magCover.src = 'images/cover'+randomNum+'.jpg';
		
		setTimeout ("randomMagCover()", 6000);
}

function randomAGGCover(){
	numCovers = 2;
	randomNum = Math.floor((Math.random() * numCovers))+1;
	document.AGGCover.src = 'images/agg-magCover'+randomNum+'.jpg';
	
	setTimeout ("randomAGGCover()", 6000);
}


//Basic check email function
function checkEMail(inEmail) {
	var locAt;
	var locPeriod;
	var okEmail;

	locAt = inEmail.indexOf("@");
	okEmail = ((locAt != -1) && 
			   (locAt != 0) &&
			   (locAt != (inEmail.length - 1)) &&
			   (inEmail.indexOf("@", locAt + 1) == -1)
			  );
	if (okEmail) {
		// so far, so good
		locPeriod = inEmail.indexOf(".");
		okEmail = ((locPeriod != -1) && (locPeriod != (inEmail.length - 1)) );
	}
	
	return okEmail;
}

//Basic CheckSpaces functin
function checkSpaces(object_value){
	var white_space = " ";
	var nonwhitestring = "";
	for (var i = 0; i < object_value.length; i++)
	{
		check_char = white_space.indexOf(object_value.charAt(i))
		if (check_char < 0){
			nonwhitestring += object_value.substring(i, (i + 1));
		}	
	}	
	if (nonwhitestring.length == 0){
    return false; //if there's something other than a space
	}
	else {return true;}
}



