
view1=0;
view2=0;
view3=0;
view4=0;
view5=0;
view6=0;

isIE5 = false;
isNS4 = (document.layers) ? true : false;
isIE5 = (document.all && document.getElementById) ? true : false;
isNS6 = (!document.all && document.getElementById) ? true : false;
/* This is the start of the code for the layers */
function show(object){
   if (isIE5 || isNS6)
      document.getElementById(object).style.visibility = "visible";
   if (isNS4)
      eval('document.' + object + '.visibility = "visible"');
}
function hide(object){
   if (isIE5 || isNS6){
   document.getElementById(object).style.visibility = "hidden";}
   if (isNS4){
      eval('document.' + object + '.visibility = "hidden"');}
}

function checka(){
	if(view1==0) {
	hide('look');
//	hide('lookRO');
	}
}

function checkb(){
	if(view2==0) {
	hide('select');
//	hide('selectRO');
	}
}

function checkc(){
	if(view3==0) {
	hide('review');
//	hide('reviewRO');
	}
}

function checkd(){
	if(view4==0) {
	hide('profile');
	}
}

function checke(){
	if(view5==0) {
	hide('products');
	}
}

function checkf(){
	if(view6==0) {
	hide('support');
	}
}

function showp(object){
	if(document.getElementById(object).style.visibility != "visible"){
		hideportfolio();
		if (isIE5 || isNS6)
		document.getElementById(object).style.visibility = "visible";
		if (isNS4)
		eval('document.' + object + '.visibility = "visible"');
	}
}

function hideportfolio(){
	hide('infoa');
	hide('infob');
	hide('infoc');
	hide('infod');
	hide('infoe');
	hide('infof');
	hide('infog');
	hide('infoh');
	hide('infoi');
	hide('infoj');
	hide('infok');
	hide('infol');
	hide('infom');
	hide('infon');
	hide('infoo');
	hide('infop');
	hide('infoq');
	hide('infor');
	hide('infos');
	hide('infot');
	hide('infou');
	hide('infov');
	hide('infow');
	hide('infox');
	hide('infoaa');
}

function newcontent(pageid){
	document.getElementById('folio').src = 'folio_detail.cfm?pageid='+pageid;
}

function showhide(clearpw, encpw){
	if (document.getElementById(clearpw).style.display == 'none'){
		document.getElementById(clearpw).style.display = 'inline';
		document.getElementById(encpw).style.display = 'none';
	}
	else{
		document.getElementById(clearpw).style.display = 'none';
		document.getElementById(encpw).style.display = 'inline';
	}
}

/* Function that swaps images. */

function di20(id, newSrc) {
    //var theImage = FWFindImage(document, id, 0);
    //if (theImage) {
        document.getElementById(id).src = newSrc;
    //}
}

/* Functions that track and set toggle group button states. */

function FWFindImage(doc, name, j) {
    var theImage = false;
    if (doc.images) {
        theImage = doc.images[name];
    }
    if (theImage) {
        return theImage;
    }
    if (doc.layers) {
        for (j = 0; j < doc.layers.length; j++) {
            theImage = FWFindImage(doc.layers[j].document, name, 0);
            if (theImage) {
                return (theImage);
            }
        }
    }
    return (false);
}

function popMpg(source){
	newView = window.open(source,"popup","width=350,height=320,resizable=0,scrollbars=0,toolbar=0,menubar=0,location=0")
	newView.focus();
}

function popPort(source){
	newView = window.open(source,"pic","width=400,height=530,resizable=0,scrollbars=0,toolbar=0,menubar=0,location=0")
	newView.focus();
}

function popLand(source){
	newView = window.open(source,"landscp","width=530,height=400,resizable=0,scrollbars=0,toolbar=0,menubar=0,location=0")
	newView.focus();
}

function popLegal(source){
	newView = window.open(source,"legal","width=400,height=300,resizable=0,scrollbars=1,toolbar=0,menubar=0,location=0")
	newView.focus();
}

function popExt(source){
	newView = window.open(source,"out","width=800,height=600,resizable=1,scrollbars=1,toolbar=1,menubar=1,location=1")
	newView.focus();
}

function popGal(source){
	newView = window.open(source,"gallery","width=600,height=550,resizable=0,scrollbars=0,toolbar=0,menubar=0,location=0")
	newView.focus();
}

function isValidDate(dateStr, sFormat) {
   var format = new String(sFormat);	
   if (format == null) { format = "MDY"; }
   format = format.toUpperCase();
   if (format.length != 3) { format = "MDY"; }
   if ( (format.indexOf("M") == -1) || (format.indexOf("D") == -1) || 
      (format.indexOf("Y") == -1) ) { format = "MDY"; }		  
   if (format.substring(0, 1) == "Y") { // If the year is first
      var reg1 = /^\d{2}(\-|\/|\.)\d{1,2}\1\d{1,2}$/
      var reg2 = /^\d{4}(\-|\/|\.)\d{1,2}\1\d{1,2}$/
   } else if (format.substring(1, 2) == "Y") { // If the year is second
      var reg1 = /^\d{1,2}(\-|\/|\.)\d{2}\1\d{1,2}$/
      var reg2 = /^\d{1,2}(\-|\/|\.)\d{4}\1\d{1,2}$/
   } else { // The year must be third
      var reg1 = /^\d{1,2}(\-|\/|\.)\d{1,2}\1\d{2}$/
      var reg2 = /^\d{1,2}(\-|\/|\.)\d{1,2}\1\d{4}$/
   }
   // If it doesn't conform to the right format (with either a 2 digit year or 4 digit year), fail
   if ( (reg1.test(dateStr) == false) && (reg2.test(dateStr) == false) ) { return false; }
   var parts = dateStr.split(RegExp.$1); // Split into 3 parts based on what the divider was
   // Check to see if the 3 parts end up making a valid date
   if (format.substring(0, 1) == "M") { var mm = parts[0]; } else 
      if (format.substring(1, 2) == "M") { var mm = parts[1]; } else { var mm = parts[2]; }
   if (format.substring(0, 1) == "D") { var dd = parts[0]; } else 
      if (format.substring(1, 2) == "D") { var dd = parts[1]; } else { var dd = parts[2]; }
   if (format.substring(0, 1) == "Y") { var yy = parts[0]; } else 
      if (format.substring(1, 2) == "Y") { var yy = parts[1]; } else { var yy = parts[2]; }
   if (parseFloat(yy) <= 50) { yy = (parseFloat(yy) + 2000).toString(); }
   if (parseFloat(yy) <= 99) { yy = (parseFloat(yy) + 1900).toString(); }
   var dt = new Date(parseFloat(yy), parseFloat(mm)-1, parseFloat(dd), 0, 0, 0, 0);
   if (parseFloat(dd) != dt.getDate()) { return false; }
   if (parseFloat(mm)-1 != dt.getMonth()) { return false; }
   	
   return true;
}



function ValidateEmail(sEmail)
{
	var filter  = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
	if (!filter.test(sEmail)) {
		return false;
	}
	return true;
}
