// ACM GLOBAL JAVASCRIPT

// Site search validation
function s_validate(formObject){if(formObject.elements['keywords'].value == '' || formObject.elements['keywords'].value == 'Search ACM'){alert('Please enter a keyword to search our site.');return false;} else {return true;}}
function clear_search(s) {if (s.defaultValue==s.value || s.value=='Search ACM') s.value = ""}

// Quicklinks Dropdown
function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

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_jumpMenuGo(selName,targ,restore){ //v3.0
  var selObj = MM_findObj(selName); if (selObj) MM_jumpMenu(targ,selObj,restore);
}

function searchthingy(frm) 
{
    if (frm == "Search ACM")
       document.search.q.value = "";
	   document.search.q.style = "border: 1px solid rgb(126, 157, 185); padding: 2px; background: rgb(255, 255, 255) url(http://www.google.com/cse/intl/en/images/google_custom_search_watermark.gif) no-repeat scroll left center; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;";
    if (frm == "")
       document.search.q.value = "Search ACM";
	   document.search.q.style = "border: 1px solid rgb(126, 157, 185); padding: 2px; background: rgb(255, 255, 255) url(http://www.google.com/cse/intl/en/images/google_custom_search_watermark.gif) no-repeat scroll left center; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;";
}




var curcontentindex=0
var messages=new Array()



function getElementByClass(classname){ 
var inc=0

var alltags=document.all? document.all : document.getElementsByTagName("*")
for (i=0; i<alltags.length; i++){

if (alltags[i].className==classname)

messages[inc++]=alltags[i]

}

}




function rotatecontent(){

//get current message index (to show it):
curcontentindex=(curcontentindex<messages.length-1)? curcontentindex+1 : 0

//get previous message index (to hide it):

prevcontentindex=(curcontentindex==0)? messages.length-1 : curcontentindex-1

messages[prevcontentindex].style.display="none" //hide previous message

messages[curcontentindex].style.display="block" //show current message

}





window.onload=function(){
if (document.all || document.getElementById){

getElementByClass("dyncontent")
setInterval("rotatecontent()", 2000)

}

}
