
/* Closes the lightbox on the HomePage */
function closeDivs() {
document.getElementById("lightbox_bg").style.display="none";
document.getElementById("lightbox_container").style.display="none";
document.getElementById("lightbox").style.display="none";
document.getElementById("lightbox_iFrame").src= "";
}

/* Show the lightbox and position in the middle of the screen. */
function openLightBox(iframePage, iframeHeight) {
	
//Get the Height and Width of the screen so the box can be centered.
var height;
var width;
if(document.all)
{
	height=document.body.offsetHeight;
	width=document.body.offsetWidth;
	divHeight=document.getElementById("lightbox").offsetHeight;
	divWidth=document.getElementById("lightbox").offsetWidth;
}
else
{
	if(document.getElementById)
	{
		height=window.innerHeight;
		width=window.innerWidth;
		divHeight=document.getElementById("lightbox").offsetHeight;
		divWidth=document.getElementById("lightbox").offsetWidth;
	}
}
getViewportScrollY = function() {
  var scrollY = 0;
  if( document.documentElement && document.documentElement.scrollTop ) {
	scrollY = document.documentElement.scrollTop;
  }
  else if( document.body && document.body.scrollTop ) {
	scrollY = document.body.scrollTop;
  }
  else if( window.pageYOffset ) {
	scrollY = window.pageYOffset;
  }
  else if( window.scrollY ) {
	scrollY = window.scrollY;
  }
  return scrollY;
};
//Assign positioning of the light box and display it.
var newTop=getViewportScrollY()+(height/2)-(divHeight/2)-330;
var newLeft=(width/2)-(divWidth/2)-400;
document.getElementById("lightbox").style.top=newTop;
document.getElementById("lightbox").style.left=newLeft;
document.getElementById("lightbox_bg").style.width=width;
document.getElementById("lightbox_container").style.width=width;
document.getElementById("lightbox_bg").style.display="block";
document.getElementById("lightbox_container").style.display="block";
document.getElementById("lightbox").style.display="block";
document.getElementById("lightbox_iFrame").src= iframePage;
document.getElementById("lightbox_iFrame").style.height=iframeHeight;
}

// Function for doing roll-over effects
function menuAction(myID, action) {
	document.getElementById(myID).style.display=action;
}

// Function for revealing more text content on the homepage

jQuery(document).ready(function() {
  jQuery(".textContent").hide();
  var myNum=1;
  var myText;
  //toggle the componenet with class msg_body
  jQuery(".heading").click(function()
  {
  	if(myNum==1) {
		myText="SHOW LESS...";
		myNum=2;
	}
	else {
		myText="READ MORE...";
		myNum=1;
	}
    jQuery(this).prev(".textContent").slideToggle(500);
	jQuery(this).html(myText);
  });
});

// Function for select boxes that forwards the option chosen to another webpage
function MM_jumpMenu(targ,selObj,restore){ //v3.0
eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
if (restore) selObj.selectedIndex=0;
} 


//Print Coupon function

function printIt(target) { 
	winId=window.open('','printwin','width=440,height=250'); 
	winId.document.write(target); 
	winId.document.close(); 
	winId.focus(); 
	if (window.print) winId.print(); 
}


// Script that sets up the javascript based transitional object on the HomePage
// See transitional_dynamic.html for full object in action.
function forwardAction() {
	if(slide_num==(mySlide.length-1)) {
		slide_num=0;
	}
	slide_num=slide_num+1;
	if(mySlide[slide_num].slice(-3)=="swf"){
		var transitional_image1so = new SWFObject(file_path + mySlide[slide_num], file_path + mySlide[slide_num], "980", "260", "5", "#000000");
		transitional_image1so.addParam("AllowScriptAccess", "always");
		transitional_image1so.addVariable("imageCellWidth", "980");
		transitional_image1so.write("transitional_image1Wrapper");
		document.getElementById("transitional_image").style.display="none";
		document.getElementById("transitional_link").style.display="none";
		document.getElementById("transitional_image1Wrapper").style.display="block";
		document.getElementById("transitional_counter").innerHTML=slide_num+" of&nbsp;";
	}
	else {
		document.getElementById("transitional_image").style.display="block";
		document.getElementById("transitional_link").style.display="block";
		document.getElementById("transitional_image1Wrapper").style.display="none";
		document.getElementById("transitional_image").src=file_path + mySlide[slide_num];
		document.getElementById("transitional_link").href=myLink[slide_num];
		document.getElementById("transitional_counter").innerHTML=slide_num+" of&nbsp;";
	}
}
function backAction() {
	slide_num=slide_num-1;
	if(slide_num==0) {
		slide_num=(mySlide.length-1);
	}
	if(mySlide[slide_num].slice(-3)=="swf"){
		var transitional_image1so = new SWFObject(file_path + mySlide[slide_num], file_path + mySlide[slide_num], "980", "260", "5", "#000000");
		transitional_image1so.addParam("AllowScriptAccess", "always");
		transitional_image1so.addVariable("imageCellWidth", "980");
		transitional_image1so.write("transitional_image1Wrapper");
		document.getElementById("transitional_image").style.display="none";
		document.getElementById("transitional_link").style.display="none";
		document.getElementById("transitional_image1Wrapper").style.display="block";
		document.getElementById("transitional_counter").innerHTML=slide_num+" of&nbsp;";
	}
	else {
	document.getElementById("transitional_image").style.display="block";
	document.getElementById("transitional_link").style.display="block";
	document.getElementById("transitional_image1Wrapper").style.display="none";
	document.getElementById("transitional_image").src=file_path + mySlide[slide_num];
	document.getElementById("transitional_link").href=myLink[slide_num];
	document.getElementById("transitional_counter").innerHTML=slide_num+" of&nbsp;";
	}
}





