p0on = new Image ();
p0on.src    = '/img/butregisterover.gif';
p0off       = new Image ();
p0off.src   = '/img/butregister.gif';

p1on        = new Image ();
p1on.src    = '/img/icotwopeopleover.gif';
p1off       = new Image ();
p1off.src   = '/img/icotwopeople.gif';

p2on        = new Image ();
p2on.src    = '/img/icofolderover.gif';
p2off       = new Image ();
p2off.src   = '/img/icofolder.gif';

function mouseon(objID){
	document.getElementById(objID).style.backgroundImage = 'URL(/img/butgreyover.gif)';
}

function mouseoff(objID){
	document.getElementById(objID).style.backgroundImage = 'URL(/img/butgrey.gif)';
}

function toggle(divId){
    var d = (document.all)? document.all[divId] : document.getElementById(divId);
    if (d.style.display=='none'||d.style.display=='') {
        d.style.display = 'block';
    }
    else {
        d.style.display = 'none';
    } 
}

function openBrWindow(theURL,winName,features) { 
       window.open(theURL,winName,features);
}


function ShowHelpPage (url) {
	hlp=window.open(url,"win",'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,width=400,height=180');
}
// Get random numbers of chathosts
function shuffle(size, max){
    arr = new Array(size);
    for(var i = 0; i < size; i++) {
        var n;
        do{
            arr[i] = Math.floor(max*Math.random());
            for( n = 0; n < i; n++) if (arr[n] == arr[i]) break;
        }
        while(n!=i);
    }
    return arr;
}

// Create the new window
function openInNewWindow(e) {
	var event = (!e)? window.event : e;
	// Abort if a modifier key is pressed
	if (event.shiftKey || event.altKey || event.ctrlKey || event.metaKey) {
		return true;
	}
	else {
		// Change "_blank" to something like "newWindow" to load all links in the same new window
		var newWindow = window.open(this.getAttribute('href'), 'Info','width=470,height=400');
		if (newWindow) {
			if (newWindow.focus) newWindow.focus();
			return false;
		}
		return true;
	}
}

function addEvent(obj,type,fn)
{
	if (obj.addEventListener)
		obj.addEventListener( type, fn, false );
	else if (obj.attachEvent)
	{
		obj["e"+type+fn] = fn;
		obj[type+fn] = function() { obj["e"+type+fn]( window.event ); }
		obj.attachEvent( "on"+type, obj[type+fn] );
	}
}

function removeEvent(obj,type,fn)
{
	if (obj.removeEventListener)
		obj.removeEventListener( type, fn, false );
	else if (obj.detachEvent)
	{
		obj.detachEvent( "on"+type, obj[type+fn] );
		obj[type+fn] = null;
		obj["e"+type+fn] = null;
	}
}

// Add the openInNewWindow function to the onclick event of links with a class name of "nwin"
function getNewWindowLinks() {
	// Check that the browser is DOM compliant
	if (document.getElementById && document.createElement && document.appendChild) {
		// Find all links
		var links = document.getElementsByTagName('a');
		var link;
		for (var i = 0; i < links.length; i++) {
			link = links[i];
			// Find all links with a class name of "nwin"
			if (/\bnwin\b/.test(link.className)) link.onclick = openInNewWindow;
		}
	}
}

function isUndefined(property){
    return (typeof property == 'undefined');
}

window.onload = function() {
// Check for click on New window  link
     if (document.getElementById('sidebar')){
        getNewWindowLinks();
    }

// Display category images
    if (document.getElementById('hpcat')){
        if(document.getElementsByTagName && document.createElement){
            wrapper = document.getElementById('hpcat');
            anchors = wrapper.getElementsByTagName('dd');
            spref   = "background:url('/img/newhp02/cat";
            ssuf    = ".jpg') no-repeat center 2px";
            for (i=0;i<anchors.length;i++){
                tmp = anchors[i];
                pnb = Math.floor(7*Math.random())+1; astyle = spref+(i+1)+pnb.toString()+ssuf;
				//alert(isUndefined(tmp.style.cssText));
                (isUndefined(tmp.style.cssText))?tmp.setAttribute('style',astyle):tmp.style.cssText = astyle;
            }
        }
    }

// Get random FLASH movie
     if (document.getElementById('canned')){
        var flmv = document.getElementById('canned');
        dn = Math.floor(3*Math.random())+1;
        var detect = navigator.userAgent.toLowerCase();
        var br = detect.indexOf('msie') + 1;
        //alert (br);
		if (br){
			dt ='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" '+
                'codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="164" height="251">'+
                '<param name="movie" value="/misc/demo'+dn+'.swf" \/>'+
                '<param name="quality" value="high" \/>'+
                '<embed src="/misc/demo'+dn+'.swf" quality="high"  width="164" height="251" '+
                'pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash"></embed>'+
                '</object>';
		} else {
        	dt = '<object type="application/x-shockwave-flash" data="/misc/demo'+dn+'.swf" width="164" height="251">'+
				'<param name="movie" value="/misc/demo'+dn+'.swf" />'+
				'<param name="quality" value="high" />'+
				'<img src="/img/spacer.gif" width="164" height="251" alt="No FLASH Player installed" /></object>';			
		}
	 flmv.innerHTML = dt;
    }

// Chosts for sidebar
    /*if (document.getElementById('fch')){    
        var chnb = 6; // Number of ch to display
        rndch = shuffle(chnb,30);res='';
        for(i=0;i<chnb;i++){
            res=res+'<dt>'+chosts.data[rndch[i]].name+"<\/dt>\n";
            res=res+'<dd><a href="/exhibprofile.html?exhibitorNick='+chosts.data[rndch[i]].name+'"><img src="img/newhome/smallimages/'+chosts.data[rndch[i]].img+'" width="56" height="41">'+chosts.data[rndch[i]].text+"<\/a><\/dd>\n";
        }
        document.getElementById('fch').innerHTML = "<dl>\n"+res+"\n<\/dl>";
    }*/
}

