function getCookie(name){ var cname = name + "="; var dc = document.cookie; if (dc.length > 0) { begin = dc.indexOf(cname); if (begin != -1) { begin += cname.length; end = dc.indexOf(";", begin); if (end == -1) end = dc.length; return unescape(dc.substring(begin, end)); } } return null; } function setArCook(value) { if (value.length>3999) alert('Your favorite arcade games list is full, Please remove a game before trying to add more'); else { var path=location.pathname; var domain=path.substring(0,path.lastIndexOf('/')) +'/'; var expire=new Date (); expire.setTime(expire.getTime() + (180 * 24 * 3600 * 1000)); document.cookie="myArcade"+"="+escape(value)+";expires="+expire.toGMTString()+";path="+domain; } } var arCook=getCookie('myArcade'); if (arCook==null) {setArCook(' '); arCook=getCookie('myArcade');} function countOccurrences(s,pt) {c=0; pos=s.indexOf(pt); while (pos!=-1) {c++; pos=s.indexOf(pt,pos+1);} return c;} function isGameAdded(n) {if (arCook.indexOf(n)!=-1) return true; else return false;} function addGame(gName,gWidth,gHeight,gUrl) { setArCook(arCook+'||'+gName+'\\1\\'+gWidth+'\\2\\'+gHeight+'\\3\\'+gUrl+'-|-');} function goGame() { var tSwf=document.aF.aS.options[document.aF.aS.selectedIndex].value; document.aF.aS.selectedIndex=0; if (countOccurrences(tSwf,',') >=2) { var tWidth=tSwf.substring(0,tSwf.indexOf(',')); tSwf=tSwf.substring(tSwf.indexOf(',')+1); var tHeight=tSwf.substring(0,tSwf.indexOf(',')); tSwf=tSwf.substring(tSwf.indexOf(',')+1); //set flash document.getElementById('swf').setAttribute('width',tWidth); document.getElementById('swf').setAttribute('height',tHeight); document.getElementById('swf').setAttribute('src',tSwf); foo('elemenId'); document.body.focus(); } } function removeGame(gName) { var lfP=arCook; var riP=lfP.substring(0,lfP.indexOf(gName)-2); lfP=lfP.substring(lfP.indexOf(gName)); if (lfP.indexOf('||')!=-1) lfP=lfP.substring(lfP.indexOf('||')); else lfP=''; riP=riP+lfP; setArCook(riP); } function displayAddRemove(nam,wi,he,ur) { if (isGameAdded(nam)==false) document.write('Add to favorite games'); else document.write('Remove from favorite games'); } function displayFavGames() { var tAr=arCook; nG=countOccurrences(tAr,'||'); myG=new Array(nG); for (i=0; i'); }