function gid(id) {return document.getElementById(id)}

function focus(id) {gid(id).focus();select(id)}
function select(id) {gid(id).select()}
function enable(id) {gid(id).removeAttribute('disabled');gid(id).style.visibility='visible';}
function disable(id) {gid(id).setAttribute('disabled',true);gid(id).style.visibility='hidden';}
function show(id) {gid(id).style.visibility='visible';}
function hide(id) {gid(id).style.visibility='hidden';}

function conf(msg) {return confirm(msg?msg:'Confirm operation?')}

function img_preview(url,closetext,prodname,width,height) {var win=window.open('','','dependent=yes,resizable=no,directories=no,location=no,menubar=no,status=no,titlebar=no,toolbar=no,scrollbars=no,width='+(width+20)+',height='+(height+45)+','+center(width+20,height+45));win.document.write('<html><head><title>'+prodname+'</title></head><body style="margin:10px;font-family:arial,sans-serif;font-size:12px;color:#444"><img src="'+url+'" width="'+width+'" height="'+height+'" title="'+prodname+'" alt="'+prodname+'" style="cursor:pointer" onClick="window.close()"><p style="color:#777;font-size:11px">'+closetext+'</p></body></html>');win.document.close()}
function center(width,height) {if(window.screen){xc=(screen.availWidth-10-width)/2;yc=(screen.availHeight-30-height)/2;return'left='+xc+',screenX='+xc+',top='+yc+',screenY='+yc;}return''}

var month_text=['01','02','03','04','05','06','07','08','09','10','11','12'];
function lzero(i) {var t=''+i;while(t.length<2){t='0'+t;}return t}
function days(year,month) {if(month==0||month==2||month==4||month==6||month==7||month==9||month==11){return 31;}if(month==3||month==5||month==8||month==10){return 30}if((year%4==0&&year%100!=0)||year%400==0){return 29}else{return 28}}
function create_ycombo(yf,mf,df,hf,mif,sf,datef,year,delta1,delta2) {cury=new Date().getFullYear();i=0;for(y=cury+delta1;y<=cury+delta2;y++){opt=new Option(y,y);yf.options[i++]=opt}yf.options.selectedIndex=year-(cury+delta1);yf.onchange=function(){create_dcombo(yf,mf,df,hf,mf,sf,datef,df.value,days(yf.value,mf.value));create_ycombo(yf,mf,df,hf,mif,sf,datef,yf.value,delta1,delta2);save(yf,mf,df,hf,mif,sf,datef)}}
function create_mcombo(yf,mf,df,hf,mif,sf,datef,month) {for(m=0;m<12;m++){mf.options[m]=new Option(month_text[m],m)}mf.options.selectedIndex=month;mf.onchange=function(){create_dcombo(yf,mf,df,hf,mif,sf,datef,df.value,days(yf.value,mf.value));save(yf,mf,df,hf,mif,sf,datef)}}
function create_dcombo(yf,mf,df,hf,mif,sf,datef,day,nr) {day=day<nr?day:nr;for(i=0;i<nr;i++){df.options[i]=new Option(lzero(i+1),i+1)}df.options.selectedIndex=day-1;df.options.length=nr;df.onchange=function(){save(yf,mf,df,hf,mif,sf,datef)}}
function create_hcombo(yf,mf,df,hf,mif,sf,datef,hours) {for(i=0;i<24;i++){hf.options[i]=new Option(lzero(i),i)}hf.options.selectedIndex=hours;hf.onchange=function(){save(yf,mf,df,hf,mif,sf,datef)}}
function create_micombo(yf,mf,df,hf,mif,sf,datef,minutes) {for(i=0;i<60;i++){mif.options[i]=new Option(lzero(i),i)}mif.options.selectedIndex=minutes;mif.onchange=function(){save(yf,mf,df,hf,mif,sf,datef)}}
function create_scombo(yf,mf,df,hf,mif,sf,datef,seconds) {for(i=0;i<60;i++){sf.options[i]=new Option(lzero(i),i)}sf.options.selectedIndex=seconds;sf.onchange=function(){save(yf,mf,df,hf,mif,sf,datef)}}
function save(yf,mf,df,hf,mif,sf,datef) {datef.value=yf.value+'-'+lzero(mf.value-0+1)+'-'+lzero(df.value)+' '+lzero(typeof(hf)!='number'?hf.value:hf)+':'+lzero(typeof(mif)!='number'?mif.value:mif)+':'+lzero(typeof(sf)!='number'?sf.value:sf)}
function sql_date(d) {return new Date(d.substring(0,4),d.substring(5,7)-1,d.substring(8,10),d.substring(11,13),d.substring(14,16),d.substring(17,19))}
function date_selector(yfield,mfield,dfield,hfield,mifield,sfield,datefield,ydelta1,ydelta2) {var datef=gid(datefield);var date=datef.value==''?new Date():sql_date(datef.value);var yf=gid(yfield);var mf=gid(mfield);var df=gid(dfield);var hf=hfield?gid(hfield):date.getHours();var mif=mifield?gid(mifield):date.getMinutes();var sf=sfield?gid(sfield):date.getSeconds();create_ycombo(yf,mf,df,hf,mif,sf,datef,date.getFullYear(),ydelta1,ydelta2);create_mcombo(yf,mf,df,hf,mif,sf,datef,date.getMonth());create_dcombo(yf,mf,df,hf,mif,sf,datef,date.getDate(),days(yf.value,mf.value));if(typeof(hf)!='number'){create_hcombo(yf,mf,df,hf,mif,sf,datef,date.getHours())};if(typeof(mif)!='number'){create_micombo(yf,mf,df,hf,mif,sf,datef,date.getMinutes())};if(typeof(sf)!='number'){create_scombo(yf,mf,df,hf,mif,sf,datef,date.getSeconds())};save(yf,mf,df,hf,mif,sf,datef)}

function do_tag_focus(tag) {ip=document.getElementsByTagName(tag);for(i=0;i<ip.length;i++){if(ip[i].attributes.getNamedItem('focused')){if(ip[i].focus){ip[i].focus()}if(ip[i].select){ip[i].select()}}}}
function do_focus() {do_tag_focus('input');do_tag_focus('select')}

function del_elem(list,elem_ref) {gid(list).removeChild(elem_ref.parentNode)}
function add_elem(list,ref,code) {elem=document.createElement('li');elem.innerHTML=gid(code).innerHTML;gid(list).insertBefore(elem,gid(ref))}

function s(id) {e=gid(id);if(e){e.style.display='block'}}
function h(id) {e=gid(id);if(e){e.style.display='none'}}
function sh(sid,hid) {s(sid);if(sid!=hid){h(hid)}return sid}

function on_load_window() {do_focus()}
window.onload=on_load_window;






//Contents for menu 
var menu=new Array()
menu[0]='<a href="http://www.javascriptkit.com">Audio kit</a>'
menu[1]='<a href="http://www.freewarejava.com">Audio speakers</a>'
menu[2]='<a href="http://codingforums.com">Audio X</a>'
menu[3]='<a href="http://www.cssdrive.com">Audio X</a>'
menu[4]='<a href="http://tools.dynamicdrive.com/imageoptimizer/">Audio X1</a>'


//Contents for menu 2, and so on
var menu1=new Array()
menu1[0]='<a href="http://www.javascriptkit.com/cutpastejava.shtml">Audio X1</a>'
menu1[1]='<a href="http://www.javascriptkit.com/javaindex.shtml">Audio X2</a>'
menu1[2]='<a href="http://news.bbc.co.uk">Audio X3</a>'
menu1[4]='<a href="http://www.javascriptkit.com/java/">Audio X4</a>'
menu1[3]='<a href="http://www.javascriptkit.com/dhtmltutors/">Audio X5</a>'
menu1[4]='<a href="http://www.javascriptkit.com/howto/">Audio kit</a>'
		
var disappeardelay=270  //menu disappear speed onMouseout (in miliseconds)
var horizontaloffset=0 //horizontal offset of menu from default location. (0-5 is a good value)

/////No further editting needed

var ie4=document.all
var ns6=document.getElementById&&!document.all

if (ie4||ns6)
document.write('<div id="dropmenudiv" style="visibility:hidden;width: 160px" onMouseover="clearhidemenu()" onMouseout="dynamichide(event)"></div>')

function getposOffset(what, offsettype){
var totaloffset=(offsettype=="left")? what.offsetLeft : what.offsetTop;
var parentEl=what.offsetParent;
while (parentEl!=null){
totaloffset=(offsettype=="left")? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop;
parentEl=parentEl.offsetParent;
}
return totaloffset;
}


function showhide(obj, e, visible, hidden, menuwidth){
if (ie4||ns6)
dropmenuobj.style.left=dropmenuobj.style.top=-500
dropmenuobj.widthobj=dropmenuobj.style
dropmenuobj.widthobj.width=menuwidth
if (e.type=="click" && obj.visibility==hidden || e.type=="mouseover")
obj.visibility=visible
else if (e.type=="click")
obj.visibility=hidden
}

function iecompattest(){
return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

function clearbrowseredge(obj, whichedge){
var edgeoffset=0
if (whichedge=="rightedge"){
var windowedge=ie4 && !window.opera? iecompattest().scrollLeft+iecompattest().clientWidth-15 : window.pageXOffset+window.innerWidth-15
dropmenuobj.contentmeasure=dropmenuobj.offsetWidth
if (windowedge-dropmenuobj.x-obj.offsetWidth < dropmenuobj.contentmeasure)
edgeoffset=dropmenuobj.contentmeasure+obj.offsetWidth
}
else{
var topedge=ie4 && !window.opera? iecompattest().scrollTop : window.pageYOffset
var windowedge=ie4 && !window.opera? iecompattest().scrollTop+iecompattest().clientHeight-15 : window.pageYOffset+window.innerHeight-18
dropmenuobj.contentmeasure=dropmenuobj.offsetHeight
if (windowedge-dropmenuobj.y < dropmenuobj.contentmeasure){ //move menu up?
edgeoffset=dropmenuobj.contentmeasure-obj.offsetHeight
if ((dropmenuobj.y-topedge)<dropmenuobj.contentmeasure) //up no good either? (position at top of viewable window then)
edgeoffset=dropmenuobj.y
}
}
return edgeoffset
}

function populatemenu(what){
if (ie4||ns6)
dropmenuobj.innerHTML=what.join("")
}


function dropdownmenu(obj, e, menucontents, menuwidth){
if (window.event) event.cancelBubble=true
else if (e.stopPropagation) e.stopPropagation()
clearhidemenu()
dropmenuobj=document.getElementById? document.getElementById("dropmenudiv") : dropmenudiv
populatemenu(menucontents)

if (ie4||ns6){
showhide(dropmenuobj.style, e, "visible", "hidden", menuwidth)
dropmenuobj.x=getposOffset(obj, "left")
dropmenuobj.y=getposOffset(obj, "top")
dropmenuobj.style.left=dropmenuobj.x-clearbrowseredge(obj, "rightedge")+obj.offsetWidth+horizontaloffset+"px"
dropmenuobj.style.top=dropmenuobj.y-clearbrowseredge(obj, "bottomedge")+"px"
}

return clickreturnvalue()
}

function clickreturnvalue(){
if (ie4||ns6) return false
else return true
}

function contains_ns6(a, b) {
while (b.parentNode)
if ((b = b.parentNode) == a)
return true;
return false;
}

function dynamichide(e){
if (ie4&&!dropmenuobj.contains(e.toElement))
delayhidemenu()
else if (ns6&&e.currentTarget!= e.relatedTarget&& !contains_ns6(e.currentTarget, e.relatedTarget))
delayhidemenu()
}

function hidemenu(e){
if (typeof dropmenuobj!="undefined"){
if (ie4||ns6)
dropmenuobj.style.visibility="hidden"
}
}

function delayhidemenu(){
if (ie4||ns6)
delayhide=setTimeout("hidemenu()",disappeardelay)
}

function clearhidemenu(){
if (typeof delayhide!="undefined")
clearTimeout(delayhide)
}
/***********************************************
* Contractible Headers script- © Dynamic Drive (www.dynamicdrive.com)
* This notice must stay intact for legal use. Last updated Mar 23rd, 2004.
* Visit http://www.dynamicdrive.com/ for full source code
***********************************************/

var enablepersist="on" //Enable saving state of content structure using session cookies? (on/off)
var collapseprevious="no" //Collapse previously open content when opening present? (yes/no)

if (document.getElementById){
document.write('<style type="text/css">')
document.write('.switchcontent{display:none;}')
document.write('</style>')
}

function getElementbyClass(classname){
ccollect=new Array()
var inc=0
var alltags=document.all? document.all : document.getElementsByTagName("*")
for (i=0; i<alltags.length; i++){
if (alltags[i].className==classname)
ccollect[inc++]=alltags[i]
}
}

function contractcontent(omit){
var inc=0
while (ccollect[inc]){
if (ccollect[inc].id!=omit)
ccollect[inc].style.display="none"
inc++
}
}

function expandcontent(cid){
if (typeof ccollect!="undefined"){
if (collapseprevious=="yes")
contractcontent(cid)
document.getElementById(cid).style.display=(document.getElementById(cid).style.display!="block")? "block" : "none"
}
}

function revivecontent(){
contractcontent("omitnothing")
selectedItem=getselectedItem()
selectedComponents=selectedItem.split("|")
for (i=0; i<selectedComponents.length-1; i++)
document.getElementById(selectedComponents[i]).style.display="block"
}

function get_cookie(Name) { 
var search = Name + "="
var returnvalue = "";
if (document.cookie.length > 0) {
offset = document.cookie.indexOf(search)
if (offset != -1) { 
offset += search.length
end = document.cookie.indexOf(";", offset);
if (end == -1) end = document.cookie.length;
returnvalue=unescape(document.cookie.substring(offset, end))
}
}
return returnvalue;
}

function getselectedItem(){
if (get_cookie(window.location.pathname) != ""){
selectedItem=get_cookie(window.location.pathname)
return selectedItem
}
else
return ""
}

function saveswitchstate(){
var inc=0, selectedItem=""
while (ccollect[inc]){
if (ccollect[inc].style.display=="block")
selectedItem+=ccollect[inc].id+"|"
inc++
}

document.cookie=window.location.pathname+"="+selectedItem
}

function do_onload(){
uniqueidn=window.location.pathname+"firsttimeload"
getElementbyClass("switchcontent")
if (enablepersist=="on" && typeof ccollect!="undefined"){
document.cookie=(get_cookie(uniqueidn)=="")? uniqueidn+"=1" : uniqueidn+"=0" 
firsttimeload=(get_cookie(uniqueidn)==1)? 1 : 0 //check if this is 1st page load
if (!firsttimeload)
revivecontent()
}
}


if (window.addEventListener)
window.addEventListener("load", do_onload, false)
else if (window.attachEvent)
window.attachEvent("onload", do_onload)
else if (document.getElementById)
window.onload=do_onload

if (enablepersist=="on" && document.getElementById)
window.onunload=saveswitchstate