// JavaScript Document
//Expand side menu code

function switchit(anchor,div){

//anchor behaviours
var anchorElement=document.getElementById(anchor);

if (anchorElement.style.display=="block"){
     anchorElement.style.display="inline-block";
     anchorElement.className = "collapsed";
   }
else {   
    anchorElement.style.display="block";
    anchorElement.className = "expanded";
  
    }
//div behvaviours
var divElement=document.getElementById(div);
if (divElement.style.display=="none"){
    divElement.style.display="block";}
else {
    divElement.style.display="none";
    }
  }  
//menu code
var time = 3000;
var numofitems = 7;

//menu constructor
function menu(allitems,thisitem,startstate){ 
  callname= "gl"+thisitem;
  divname="subglobal"+thisitem;  
  this.numberofmenuitems = allitems;
  this.caller = document.getElementById(callname);
  this.thediv = document.getElementById(divname);
  this.thediv.style.visibility = startstate;
}

//menu methods
function ehandler(event,theobj){
  for (var i=1; i<= theobj.numberofmenuitems; i++){
    var shutdiv =eval( "menuitem"+i+".thediv");
    shutdiv.style.visibility="hidden";
  }
  theobj.thediv.style.visibility="visible";
}
				
function closesubnav(event){
  //if ((event.clientY <48)||(event.clientY > 107)){
    for (var i=1; i<= numofitems; i++){
      var shutdiv =eval('menuitem'+i+'.thediv');
    //  shutdiv.style.visibility='hidden';
    }
  //}
}
// end menu code

/*disable right click methods

function right(e) {
if (navigator.appName == 'Netscape' && 
(e.which == 3 || e.which == 2))
return false;
else if (navigator.appName == 'Microsoft Internet Explorer' && 
(event.button == 2 || event.button == 3)) {
alert("Sorry, you do not have permission to right click.");
return false;
}
return true;
}

document.onmousedown=right;
document.onmouseup=right;
if (document.layers) window.captureEvents(Event.MOUSEDOWN);
if (document.layers) window.captureEvents(Event.MOUSEUP);
window.onmousedown=right;
window.onmouseup=right;*/

//Drop down list hover hack for IE6

sfHover = function() {
	var sfEls = document.getElementById("nav").getElementsByTagName("li");
	for (var i=0; i<sfEls.length; i++) {
		sfEls[i].onmouseover=function() {
			this.className+=" sfhover";
		}
		sfEls[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
		}
	}
}
if (window.attachEvent) window.attachEvent("onload", sfHover);


/***********************************************
* AnyLink Drop Down Menu- © Dynamic Drive (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit http://www.dynamicdrive.com/ for full source code
***********************************************/

//Contents for menu 2
var menu2=new Array()
menu2[0]='<a href="Sitemap.aspx">site map</a>'


//Contents for menu 3
var menu3=new Array()
menu3[0]='<a href="buyers/Intro.aspx">online advantages</a>'
menu3[1]='<a href="buyers/HowToBuy.aspx">quick guide to buying art</a>'
menu3[2]='<a href="buyers/Choosing.aspx">choosing the right art for you</a>'
menu3[3]='<a href="buyers/Protect.aspx">protecting yourself</a>'
menu3[4]='<a href="buyers/Returns.aspx">guarantees, returns & problems</a>'
menu3[5]='<a href="buyers/Select.aspx">ArtSales select</a>'

//Contents for menu 4
var menu4=new Array()
menu4[0]='<a href="sellers/QuickSellGuide.aspx">quick guide to selling art</a>'
menu4[1]='<a href="sellers/Photos.aspx">photographing art for the web</a>'
menu4[2]='<a href="sellers/Pricing.aspx">pricing your art</a>'
menu4[3]='<a href="sellers/Intro.aspx">create your online gallery</a>'
menu4[4]='<a href="sellers/UploadingArt.aspx">uploading and editing art</a>'
menu4[5]='<a href="sellers/Packing.aspx">packing & shipping art</a>'
menu4[6]='<a href="sellers/GettinPaid.aspx">getting paid</a>'


//Contents for menu 5
var menu5=new Array()
menu5[0]='<a href="services/Intro.aspx">visual index</a>'
menu5[1]='<a href="services/ArtIcons.aspx">art icons</a>'
menu5[2]='<a href="services/Ecards.aspx">online postcards</a>'
menu5[3]='<a href="services/SigFilePublic.aspx">art e-mail signature files</a>'
menu5[4]='<a href="services/Create.aspx">create art online</a>'
menu5[5]='<a href="services/Playc.aspx">play with the universe</a>'
menu5[6]='<a href="services/Phone.aspx">art for your phone</a>'
menu5[7]='<a href="services/News.aspx">news & whats on</a>'
menu5[8]='<a href="services/About.aspx">about art: knowledge base</a>'
menu5[9]='<a href="services/BlogLovers.aspx">community and artlovers</a>'
menu5[10]='<a href="services/RSS.aspx">be the first to know</a>'

//Contents for menu 6
var menu6=new Array()
menu6[0]='<a href="Fineprint/AboutUs.aspx">about us</a>'
menu6[1]='<a href="Fineprint/ContactUs.aspx">contact us</a>'
menu6[2]='<a href="Fineprint/Testimonials.aspx">testimonials</a>'

//Contents for menu 7, and so on
var menu7=new Array()
menu7[0]='<a href="FinePrint/Privacy.aspx">privacy policy</a>'
menu7[1]='<a href="FinePrint/Terms.aspx">terms & conditions</a>'
menu7[2]='<a href="FinePrint/Use.aspx">user agreement</a>'

//Contents for menu 8, and so on
var menu8=new Array()
menu8[0]='<a href="FinePrint/Copyright.aspx">copyright</a>'
menu8[1]='<a href="FinePrint/Infringe.aspx">copyright infringement</a>'
menu8[2]='<a href="FinePrint/CommUse.aspx">commercial use overview</a>'
menu8[3]='<a href="FinePrint/Editorial.aspx">editorial license</a>'
menu8[4]='<a href="FinePrint/MockUp.aspx">mock up license</a>'
menu8[5]='<a href="FinePrint/RoyaltyFree.aspx">royalty free license</a>'
		
var menuwidth='165px' //default menu width
var menubgcolor='white'  //menu bgcolor
var disappeardelay=250  //menu disappear speed onMouseout (in miliseconds)
var hidemenu_onclick="yes" //hide menu when user clicks within menu?

/////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:'+menuwidth+';background-color:'+menubgcolor+'" 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="-500px"
if (menuwidth!=""){
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 < 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 up?
edgeoffset=dropmenuobj.contentmeasure+obj.offsetHeight
if ((dropmenuobj.y-topedge)<dropmenuobj.contentmeasure) //up no good either?
edgeoffset=dropmenuobj.y+obj.offsetHeight-topedge
}
}
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")+"px"
dropmenuobj.style.top=dropmenuobj.y-clearbrowseredge(obj, "bottomedge")+obj.offsetHeight+"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)
}

if (hidemenu_onclick=="yes")
document.onclick=hidemenu
