function changeClass(inid,c){document.getElementById(inid).className=c;}
function textclear(id,text){x=document.getElementById(id);if(x.value==text){x.value="";}else{}}
function setStyle(id,strname,strvalue){x = document.getElementById(id);y = eval("x.style."+strname);y = strvalue;}
function clearstyle(inid){x=document.getElementById(inid);x.style.backgroundColor="#cfc";}
function errorstyle(inid){x=document.getElementById(inid);x.style.backgroundColor="#fcc";}

function notnull(inid){x=document.getElementById(inid);if (x.value ==""){errorstyle(inid);return false;} else {clearstyle(inid);return true;}}
function checkEmail(inid) {var email = document.getElementById(inid);var reg = new RegExp("^[0-9a-zA-Z]+@[0-9a-zA-Z]+[\.]{1}[0-9a-zA-Z]+[\.]?[0-9a-zA-Z]+?$");if (reg.test(email.value)) {clearstyle(inid);return true;} else {errorstyle(inid);return false;}}
function checkDOB(inid){var dob = document.getElementById(inid);var reg = new RegExp("^[0-9]{1,2}[\/\.\\\-]{1}[0-9]{1,2}[\/\.\\\-]{1}[0-9]{4}$");if (reg.test(dob.value)) {clearstyle(inid);return true;} else {errorstyle(inid);return false;}}

function checkLen(inid,len){var el = document.getElementById(inid);if(el.value.length == len){clearstyle(inid);return true;} else {errorstyle(inid);return false;}}

function checkPhone(inid){var phone = document.getElementById(inid);var reg = new RegExp("^[ ()\-\+0-9]{6,15}$");if (reg.test(phone.value)) {clearstyle(inid);return true;} else {errorstyle(inid);return false;}}

function DisableLinks(xHow){objLinks = document.getElementsByTagName("a");for(i=0;i<objLinks.length;i++){if (xHow == true){objLinks[i].onclick = function(){return false;};} else {objLinks[i].onclick = function(){return true;};}}}

function getScrollY() {var scrOfX = 0, scrOfY = 0;if( typeof( window.pageYOffset ) == 'number' ) {scrOfY = window.pageYOffset;scrOfX = window.pageXOffset;} else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {scrOfY = document.body.scrollTop;scrOfX = document.body.scrollLeft;} else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {scrOfY = document.documentElement.scrollTop;scrOfX = document.documentElement.scrollLeft;}return scrOfY;}
function getDocHeight() {var D = document;return Math.max(Math.max(D.body.scrollHeight, D.documentElement.scrollHeight),Math.max(D.body.offsetHeight, D.documentElement.offsetHeight),Math.max(D.body.clientHeight, D.documentElement.clientHeight));}
function GetWidth(){var x = 0;if (self.innerHeight){x = self.innerWidth;} else if (document.documentElement && document.documentElement.clientHeight){x = document.documentElement.clientWidth;} else if (document.body){x = document.body.clientWidth;}return x;}
function GetHeight(){var y = 0;if (self.innerHeight){y = self.innerHeight;} else if (document.documentElement && document.documentElement.clientHeight){y = document.documentElement.clientHeight;} else if (document.body){y = document.body.clientHeight;}return y;}

function hideelement(inid){x = document.getElementById(inid);x.style.display="none";x.style.visibility="hidden";}
function showelement(inid){x = document.getElementById(inid);x.style.display="block";x.style.visibility="visible";}

function getElWidth(inid){return document.getElementById(inid).offsetWidth;}
function getElHeight(inid){return document.getElementById(inid).offsetHeight;}

function makesubbox(boxtitle, boxmessage, divtarget){
	DisableLinks(true);
	showelement(divtarget);
	x = document.getElementById(divtarget);
	x.style.zIndex=100;
	x.style.position="absolute";
	x.style.left=((GetWidth()/2)-275) +"px";
	mheight = parseInt(document.getElementsByTagName("div")[divtarget].offsetHeight)/2;
	x.style.top = (((GetHeight()/2)-mheight) + getScrollY()) + "px";
	document.getElementById(divtarget).innerHTML = "<div style=\"width:510px;padding:20px;background:#fff;border:1px solid #291957;-moz-box-shadow: 5px 5px 5px #291957;-webkit-box-shadow: 5px 5px 5px #291957;box-shadow: 5px 5px 5px #291957;\"><h3 class=\"nopad fleft\">"+boxtitle+"<\/h3><span class=\"fright small click\" onclick=\"DisableLinks(false); hideelement('"+divtarget+"');\">Click Here To Close<\/span><hr class=\"clear\" \/>"+boxmessage+"<\/div>";
	mheight = parseInt(document.getElementsByTagName("div")[divtarget].offsetHeight)/2;
	x.style.top = (((GetHeight()/2)-mheight) + getScrollY()) + "px";
}


function doOpaque(inid,inopacity){mozopac=inopacity/100;x=document.getElementById(inid);x.style.filter="alpha(opacity="+inopacity+")";x.style.opacity=mozopac;}
var contents=new Array();

img1 = new Image();img1.src = "animation/iStock_000002782105XSmall.jpg";
img2 = new Image();img2.src = "animation/iStock_000003028902XSmall.jpg";
img3 = new Image();img3.src = "animation/membrane003.jpg";
img4 = new Image();img4.src = "animation/membrane050_adj_flat.jpg";
img5 = new Image();img5.src = "animation/membrane064.jpg";
img6 = new Image();img6.src = "animation/membrane070.jpg";

contents[0]="#ffffff url(animation/iStock_000002782105XSmall.jpg) center center no-repeat";
contents[1]="#ffffff url(animation/iStock_000003028902XSmall.jpg) center center no-repeat";
contents[2]="#ffffff url(animation/membrane003.jpg) center center no-repeat";
contents[3]="#ffffff url(animation/membrane050_adj_flat.jpg) center center no-repeat";
contents[4]="#ffffff url(animation/membrane064.jpg) center center no-repeat";
contents[5]="#ffffff url(animation/membrane070.jpg) center center no-repeat";
var display = 0;
var total=5;
function updatetext(){if(document.getElementById("mg")){rm=document.getElementById("mg");if(display!=total){rm.style.opacity=1.0;rm.style.filter='alpha(opacity=100)';rm.style.background=contents[(display+1)];}else{rm.style.opacity=1.0;rm.style.filter='alpha(opacity=100)';rm.style.background=contents[0];}
xdisplay=display+1; if(xdisplay>total){xdisplay=0;}

rr=document.getElementById("bg");rr.style.background=contents[display];opacity=0;edisplay=display+1;if(edisplay>total){edisplay=0;}if(display>0){display-=1;}else{display=total;}
if(document.getElementById("subtext")){
mysubt=document.getElementById("subtext");mysubtopacity=.05;mysubt.style.opacity = mysubtopacity;mysubt.style.filter='alpha(opacity='+(mysubtopacity*10)+')';}
var t=setTimeout("fadein()",5000);}}

function fadein(){
if(opacity<11){value=(10-opacity);y=document.getElementById("mg");
y.style.opacity=value/10;y.style.filter='alpha(opacity='+value*10+')';
var t=setTimeout("fadein()",50);opacity++;}else{updatetext();}}


function init(){
if(document.getElementById("mg")){updatetext();}
}


window.onload = init;
