// Rotates home page images
function rotate () {
	var how_many_ads = 13;
	var now = new Date()
	var sec = now.getSeconds()
	var ad = sec % how_many_ads;
	ad +=1;
	
	if (ad==1) 
			{bg="homebg1";}
	if (ad==2) 
			{bg="homebg2";}
	if (ad==3) 
			{bg="homebg3";}
	if (ad==4) 
			{bg="homebg4";}
	if (ad==5) 
			{bg="homebg5";}
	if (ad==6) 
			{bg="homebg6";}
	if (ad==7) 
			{bg="homebg7";}
	if (ad==8) 
			{bg="homebg8";}
	if (ad==9) 
			{bg="homebg9";}
	if (ad==10) 
			{bg="homebg1";}
	if (ad==11) 
			{bg="homebg2";}
	if (ad==12) 
			{bg="homebg10";}	
	if (ad==13) 
			{bg="homebg11";}									
	
	document.getElementById('content').className=bg;
}

// Timer to remove/hide release overview badge 				- http://www.ricocheting.com/js/countdown.html

// NOTE: the month entered must be one less than current month. ie; 0=January, 11=December
// NOTE: the hour is in 24 hour format. 0=12am, 15=3pm etc
// format: dateFuture = new Date(year,month-1,day,hour,min,sec)
// example: dateFuture = new Date(2003,03,26,14,15,00) = April 26, 2003 - 2:15:00 pm

dateFuture = new Date(2008,01,9,10,53,00);

function GetCount(){

	dateNow = new Date();											//grab current date
	amount = dateFuture.getTime() - dateNow.getTime();		//calc milliseconds between dates
	delete dateNow;

	// time is already past
	if(amount > 0){
		rohide = document.getElementById('release-overview');
		rohide.style.display="block";
	}
	// date is still good
	else{
		setTimeout("GetCount()", 1000);
	}
}

// Email Spam Prevention
function writeEmail(user)	{
	var site = "eReinsure.com";
	document.write('<a href=\"mailto:' + user + '@' + site + '\" class=\"mediumLink\">' + user + '@' + site + '</a>');
}

// Contact Us Form Submit
query = location.search;
url = query.substring(1, query.length);
qs = query.substring(0,1);
var strMsg
if (qs.length > 0 ){
	//comment out the following line if the parameter is passed base64 encoded
	//url = base64encode(url);
	uName = base64decode(url)
	if (uName.length > 0) {
		showName = true;
	}
	else {
		showName = false;
	}
	strMsg = "<span class='sectionSub1Header' style='color:#C13D29;'> Thank you for your interest" + (showName ? ', '+uName+'.' : '.') + " <br/>We will contact you as soon as possible. <br/><br/></span>";
}
else {
	strMsg = "";
}

function postForm(){
          frm.referrer.value = window.location.href;
          return true;
}

// Contact Focus First Field
/*
function placeFocus() {
if (document.forms.length > 0) {
var field = document.forms[0];
for (i = 0; i < field.length; i++) {
if ((field.elements[i].type == "text") || (field.elements[i].type == "textarea") || (field.elements[i].type.toString().charAt(0) == "s")) {
document.forms[0].elements[i].focus();
break;
         }
      }
   }
}
*/

// Map Pop-Up
function mapslc() {
  plain_window = 
    window.open("map-slc.html","mapwindow","width=770,height=480");
	}

function mapny() {
  plain_window = 
    window.open("map-ny.html","mapwindow","width=770,height=480");
	}

function maplondon() {
  plain_window = 
    window.open("map-london.html","mapwindow","width=770,height=480");
	}
	
// Pop-Up General  :  example <a href="popupex.html" onclick="return popitup('popupex.html')">Link to popup</a
function popitup(url) {
	newwindow=window.open(url,'name','height=650,width=700,location,menubar,resizable,scrollbars,status,toolbar');
	if (window.focus) {newwindow.focus()}
	return false;
}
