function Init(timeout,sURL) { // var timeout; var sURL; setTimeout( "refresh('" + sURL + "')", timeout*1000); } function refresh(sURL) { storeSettings(); window.location.replace( sURL ); } function screensize() { alert('Your screen is:\n\n' + screen.width + ' pixels by ' + screen.height + ' pixels'); } function Init(timeout,sURL) { setTimeout( "refresh('" + sURL + "')", timeout*1000);} function refresh(sURL) { storeSettings(); window.location.replace( sURL ); } function selectstore(store, query) {if (query.length > 0) { store=store+query location.href=store } return } function MakeArray(n) { this.length = n return this } monthNames = new MakeArray(12) monthNames[1] = "January" monthNames[2] = "February" monthNames[3] = "March" monthNames[4] = "April" monthNames[5] = "May" monthNames[6] = "June" monthNames[7] = "July" monthNames[8] = "August" monthNames[9] = "September" monthNames[10] = "October" monthNames[11] = "November" monthNames[12] = "December" function customDateString() { var currentDate = new Date(); var theMonth = monthNames[currentDate.getMonth() + 1]; msie4 = ((navigator.appName == "Microsoft Internet Explorer") && (parseInt(navigator.appVersion) >= 4 )); if (msie4) { var theYear = currentDate.getYear(); } else { var theYear = currentDate.getYear() +1900; } return theMonth + " " + currentDate.getDate() + ", " + theYear; } function GetDate() { var now = new Date(); var day = now.getDate(); var month = now.getMonth()+1; var year = now.getYear(); var date = month + "/" + day + "/" + year; return date } function getdate() { return Date() } function createCookie(name,value,days) { if (days) { var date = new Date(); date.setTime(date.getTime()+(days*24*60*60*1000)); var expires = "; expires="+date.toGMTString(); } else var expires = ""; document.cookie = name+"="+value+expires+"; path=/"; } function readCookie(name) { var nameEQ = name + "="; var ca = document.cookie.split(';'); for(var i=0;i < ca.length;i++) { var c = ca[i]; while (c.charAt(0)==' ') c = c.substring(1,c.length); if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length); } return null; } function eraseCookie(name) { createCookie(name,"",-1); } function pageWidth() { return window.innerWidth != null? window.innerWidth : document.documentElement && document.documentElement.clientWidth ? document.documentElement.clientWidth : document.body != null ? document.body.clientWidth : null; } function pageHeight() {return window.innerHeight != null? window.innerHeight : document.documentElement && document.documentElement.clientHeight ? document.documentElement.clientHeight : document.body != null? document.body.clientHeight : null;} function storeSettings() { width=screen.width; width=window.innerWidth; width=pageWidth(); height=screen.height; height=window.innerHeight; height=pageHeight(); createCookie('displayWidth',width,365); createCookie('displayHeight',height,365); return null; } function erasesaved(formname,refresh) { // remove cookie "play", cookie songlist. Alert ack eraseCookie("play") eraseCookie("Songlist") //alert("Erased Playlist"); document.commandform.status.value="Erased your Playlist"; if (refresh) location.reload(true); } function playall(formname) { // remove cookie "play". jump to index eraseCookie("play") document.commandform.status.value="Your Playlist is disabled. Playing all songs"; window.location.replace( 'http://www.salestron.com/' ); } function playsaved(formname) { var songlist; // set cookie play=Songlist, cookie idx=n, jump to index.html?$play=Songlist songlist=readCookie('Songlist'); if (!songlist) { document.commandform.status.value="Cannot play an empty playlist"; eraseCookie("play") eraseCookie("Songlist") return; } idx=songlist.split(',',1) ; createCookie('idx',idx,365); // song number createCookie('play','Songlist',365); document.commandform.status.value="Playlist Playing"; window.location.replace( 'http://www.salestron.com/?play=Songlist' ); } function addsongs(formname,refresh) { // need to: if songlist cookie exists, get it and explode into array. Then add new selection array to it. ack selection added. var currentsonglist = new Array(); //alert("break 1"); list=readCookie('Songlist'); if (list) currentsonglist=list.split(',') ; var songlist=new Array(); sz=formname.length; var i=0; for (var j = 0; j < sz; j++) { box = eval("formname[j]"); if (box.checked == true) { // add to array // if (formname[j].name!="status" || formname[j].name!='' || formname[j].name!='cmd') songlist[i]=formname[j].name; i+=1; } } updatedsonglist=currentsonglist.concat(songlist); text=updatedsonglist.toString(); if (text.length>4096) { alert ("Playlist cookie storage for about 1000 songs is exceeded ! Update canceled "); return; } if (text.length<1) { eraseCookie("Songlist"); eraseCookie("play"); document.commandform.status.value="Playlist is now empty"; } else { createCookie('Songlist',text,365); document.commandform.status.value="Put "+i+" songs into new playlist"; } if (refresh) location.reload(true); } function checkAll(formname) { sz=formname.length; for (var j = 0; j < sz; j++) { box = eval("formname[j]"); if (box.checked == false) box.checked = true; } document.commandform.status.value="Checked "+sz+" items"; } function uncheckAll(formname) { sz=formname.length; for (var j = 0; j < sz; j++) { box = eval("formname[j]"); if (box.checked == true) box.checked = false; } document.commandform.status.value="Unchecked "+sz+" items"; } function switchAll(formname) { sz=formname.length; for (var j = 0; j < sz; j++) { box = eval("formname[j]"); box.checked = !box.checked; } document.commandform.status.value="Flipped "+sz+" items"; } function updatesongs(formname) { var songlist=new Array(); sz=formname.length; var i=0; for (var j = 0; j < sz; j++) { box = eval("formname[j]"); if (box.checked == true) { // add to array // if (formname[j].name!="status" || formname[j].name!='' || formname[j].name!='cmd') songlist[i]=formname[j].name; i+=1; } } //updatedsonglist=currentsonglist.concat(songlist); //text=updatedsonglist.toString(); text=songlist.toString(); if (text.length>4096) { alert ("Playlist cookie storage for about 1000 songs is exceeded ! Update canceled "); return; } if (text.length<1) { eraseCookie("Songlist"); eraseCookie("play"); document.commandform.status.value="Playlist is now empty"; location.reload(true) } else { createCookie('Songlist',text,365); document.commandform.status.value="Put "+i+" songs into new playlist"; location.reload(true) } } function jump(address) { //goto="http://www.salestron.com/"+address; window.location.replace( address); } //***************** // start 1 second interval time to show remaining seconds til next song //***************** function songtimer(songtime) { var songtime; var counter; counter=document.timer.remaining.value; if (!counter) counter=songtime; if (counter>0) counter--; document.timer.remaining.value=counter; }