/*  flash embedding */
 document.write("<script language='JavaScript' src='/scripts/flash.js'><\/script>");
// --------------- //

 InternetExplorer = navigator.appName.indexOf("Microsoft") != -1;
 NS4 = (document.layers);
 IE4 = (document.all);
 ver4 = (NS4 || IE4);
 IE5 = (IE4 && navigator.appVersion.indexOf("5.")!=-1);
 isMac = (navigator.appVersion.indexOf("Mac") != -1);

 if (!InternetExplorer) document.write("<script language='JavaScript' src='/scripts/mozilla.js'><\/script>");

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function centerWindow(windowID, resizeX, resizeY) {
 if (resizeX != null && resizeY != null) windowID.resizeTo(resizeX, resizeY);
 else {
  if (document.body.clientWidth == null || (document.body.clientWidth != null && document.body.clientWidth == 0)) return;

  resizeX=document.body.clientWidth;
  resizeY=document.body.clientHeight;
 }

 windowID.moveTo(screen.availHeight/2-resizeX/2, screen.availHeight/2-resizeY/2);
 windowID.focus();
}

function skinAlert() {
 alert('Please note: A skin will now open; all images, icons, colors and content in this skin\ncan be changed by YOU at any time using the Morphogine WebPresence software.');
}

function popURL(url, w, h, scrollbars, center, toolbar, resizable, name) {
 if (w == null) w = 540;
 if (h == null) h = 540;
 if (scrollbars == null) scrollbars = 'yes';
 if (center == null) center = false;

 lt = (center) ? ',left='+(screen.availWidth - w) / 2 + ',top='+(screen.availHeight - h) / 2 : '';

 if (url.indexOf(':') == -1 && url.indexOf('/p/') == -1) url = '/index.cfm/p/'+url; 

 wID = window.open(url,name,'menubar=no,resizable=no,width='+w+',height='+h+',scrollbars='+scrollbars+',statusbar=no,toolbar=no'+lt);
 wID.focus();
}

function checkSearch() {
 if (document.search.searchStr.value.length < 3) { alert("Please enter a search string of at least 3 characters."); document.search.searchStr.focus(); return false; }
 else return true;
}

function check_email(email) {
 if (email.indexOf('@')==-1 || email.indexOf('.')==-1) return false; 
 else return true; 
}

var lastID = 0;

function showID(which) {
 if (lastID != 0) {
  document.getElementById('A'+lastID).style.display = 'none';
  if (document.getElementById('tree'+lastID) != null) document.getElementById('tree'+lastID).src = '/images/tree.gif';
 }

 document.getElementById('A'+which).style.display = '';
 if (document.getElementById('tree'+which) != null) document.getElementById('tree'+which).src = '/images/tree2.gif';

 lastID = which;
}

function printALLID() {
 arr = new Array('A','AF','AC','A0','P','AP','AO');

 for (var a = 0; a<arr.length; a++) {
  if (document.getElementById(arr[a]+'1') == null) continue;

  for (var i = 1; i<100; i=i+1) {
   if (document.getElementById(arr[a]+i) == null) break;
   else document.getElementById(arr[a]+i).style.display = '';
  }
 }

 if (window.print) window.print()
 else alert("Sorry, your browser doesn't support this feature.");

 for (var a = 0; a<arr.length; a++) {
  if (document.getElementById(arr[a]+'1') == null) continue;

  for (var i = 1; i<100; i=i+1) {
   if (document.getElementById(arr[a]+i) == null) break;
   else document.getElementById(arr[a]+i).style.display = 'none';
  }
 }
}

function checkLogin() {
 if (document.clients.domain.value.length < 3) { alert("Please enter your domain name."); document.clients.domain.focus(); return false; }
 else if (document.clients.username.value.length < 3) { alert("Please enter your username."); document.clients.username.focus(); return false; }
 else if (document.clients.password.value.length < 3) { alert("Please enter your password."); document.clients.password.focus(); return false; } 
 else return true;
}

function Vote() {
 var error=0;
 for (var i=0; i<document.Voting.Answer.length; i++) { if (eval('document.Voting.Answer['+i+'].checked==0')) error++; }
 if (error!=document.Voting.Answer.length) document.Voting.submit();
 else { alert('Please select an answer.'); }
}

function nextTopic() {
 cachePattern = /[\?&]nocache=.+/;
 loc = document.location.toString().replace(cachePattern, '');
 document.location = loc + ((loc.indexOf('?') == -1) ? '?':'&') + 'nocache='+ (Math.round((Math.random()*9)+1)) + '' + (Math.round((Math.random()*9)+1));   
}

function results(ID) {
 document.location = '/index.cfm/p/voting/VID/'+ID+'/nocache/'+ (Math.round((Math.random()*9)+1)) + '' + (Math.round((Math.random()*9)+1));
}

function printPage() {
 if (window.print) window.print()
 else alert("Sorry, your browser doesn't support this feature.");
}

function visi(showlist, action, hidelist) {
 if (hidelist != null) {
  hidelist = hidelist.split(",");
  for (i = 0; i<hidelist.length; i++) eval('document.getElementById("' + hidelist[i] + '")').style.display = (!action) ? '' : 'none'; 
 }  
 if (showlist != null) {
  showlist = showlist.split(",");
  for (i = 0; i<showlist.length; i++) eval('document.getElementById("' + showlist[i] + '")').style.display = (action) ? '' : 'none'; 
 }
}

function showApplication(hide, show) {
	document.getElementById(hide).style.display='none';
	document.getElementById(show).style.display='';
}
