sfHover = function() {
	var sfEls = document.getElementById("newheader_rollover");//
	if (sfEls!=null)
	{
		sfEls =	sfEls.getElementsByTagName("LI");
	}
	else if (sfEls==null)	
	{
		sfEls = document.getElementById("rollover");
		if (sfEls==null)
		{
			return;
		}
                else
		{
			sfEls =	sfEls.getElementsByTagName("LI");
		}
	}
	else 
	{
		return;
	}
	
	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);


function checkReturn(obj,e) {

 if (e.keyCode == 13 || e.which == 13) 
	{
		var form = window.document.forms[0];
		var clicknext = false;
		var nextobj;
		for ( var i=0;i < form.elements.length; i++ )
		{	
			if (form.elements[i]==obj) clicknext=true;
			
			if (clicknext) 
			{
				nextobj=form.elements[i];
				if (nextobj.type.toUpperCase()=="BUTTON" || nextobj.type.toUpperCase()=="SUBMIT") 
				{
					nextobj.click(); 
					break;
				}
			}
		} 
		return false;
	}
return true;
}

//For the First.htm top part

function updateTop(conf, params)
{

	paramArr = params.split('|');
	
	efirst = paramArr[0]
	wfirst = paramArr[1]
	gfirst = paramArr[2]
	allcateg = paramArr[3]

	var frst = document.getElementById("frst_tab")
	var scnd = document.getElementById("scnd_tab")
	/**/var thrd = document.getElementById("thrd_tab")
	var frstnav = document.getElementById("frst_nav")
	var scndnav = document.getElementById("scnd_nav")
	/**/var  thrdnav = document.getElementById("thrd_nav")
	var tempnav = document.getElementById("temp_nav")
	
	if (tempnav != null) { tempnav.style.display = 'none' }
	
/**/	if (conf == "thrd") {
		thrd.innerHTML = '<img class="blue" src="/amsterdam/pict/budgetpro_tab1.gif" width="157" height="20" alt="Digital Budget Pro Wall Calendar" />'
		scnd.innerHTML = '<a href="javascript:void(0);" onclick="updateTop(\'scnd\',\''+params+'\')"><img class="or" src="/amsterdam/pict/magnet_tab.gif" width="157" height="20" alt="Digital Magent" /></a>'
		frst.innerHTML = '<a href="javascript:void(0);" onclick="updateTop(\'frst\',\''+params+'\')"><img class="or" src="/amsterdam/pict/mug_tab.gif" width="157" height="20" alt="Devall Pen" /></a>'
		if (thrdnav != null && scndnav != null && frstnav != null) {
			frstnav.style.display = 'none'
			scndnav.style.display = 'none'
			thrdnav.style.display = 'block'
		}
		categ = gfirst
		
	} 
	
	
	if (conf == "scnd") {
		scnd.innerHTML = '<img class="blue" src="/amsterdam/pict/magnet_tab1.gif" width="157" height="20" alt="Showcase Key Tag" />'
		thrd.innerHTML = '<a href="javascript:void(0);" onclick="updateTop(\'thrd\',\''+params+'\')"><img class="or" src="/amsterdam/pict/budgetpro_tab.gif" width="157" height="20" alt="Digital Budget Pro Wall Calendar" /></a>'
		frst.innerHTML = '<a href="javascript:void(0);" onclick="updateTop(\'frst\',\''+params+'\')"><img class="or" src="/amsterdam/pict/mug_tab.gif" width="157" height="20" alt="Devall Pen" /></a>'
		if (scndnav != null && frstnav != null) {
			frstnav.style.display = 'none'
			scndnav.style.display = 'block'
			thrdnav.style.display = 'none'
		}
		categ = wfirst
		
	} 
	
	else if (conf == "frst") {
		frst.innerHTML = '<img class="blue" src="/amsterdam/pict/mug_tab1.gif" width="157" height="20" alt="Devall Pen" />'
		scnd.innerHTML = '<a href="javascript:void(0);" onclick="updateTop(\'scnd\',\''+params+'\')"><img class="or" src="/amsterdam/pict/magnet_tab.gif" width="157" height="20" alt="Showcase Key Tag" /></a>'
		thrd.innerHTML = '<a href="javascript:void(0);" onclick="updateTop(\'thrd\',\''+params+'\')"><img class="or" src="/amsterdam/pict/budgetpro_tab.gif" width="157" height="20" alt="Digital Budget Pro Wall Calendar" /></a>'
		if (frstnav != null && scndnav != null) {
			scndnav.style.display = 'none'
			frstnav.style.display = 'block'
			thrdnav.style.display = 'none'
		}
		categ = efirst
		
	}

	updateMid(categ,"",allcateg)

}


function updateTopTimer(confDup, paramDup)
{
	conf = "frst";
	params = "f1|s1|t1|f1,f4,f3,f2,s4,s1,s3,s2";

	if(confDup != null && paramDup != null)
{
	conf = confDup;
	params = paramDup;
}

	paramArr = params.split('|');
	
	efirst = paramArr[0]
	wfirst = paramArr[1]
	gfirst = paramArr[2]
	allcateg = paramArr[3]

	var frst = document.getElementById("frst_tab")
	var scnd = document.getElementById("scnd_tab")
	/**/var thrd = document.getElementById("thrd_tab")
	var frstnav = document.getElementById("frst_nav")
	var scndnav = document.getElementById("scnd_nav")
	/**/var  thrdnav = document.getElementById("thrd_nav")
	var tempnav = document.getElementById("temp_nav")
	
	if (tempnav != null) { tempnav.style.display = 'none' }
	
/**/	if (conf == "thrd") {
		thrd.innerHTML = '<img class="blue" src="/amsterdam/pict/budgetpro_tab1.gif" width="157" height="20" alt="Digital Budget Pro Wall Calendar" />'
		scnd.innerHTML = '<a href="javascript:void(0);" onclick="updateTop(\'scnd\',\''+params+'\')"><img class="or" src="/amsterdam/pict/magnet_tab.gif" width="157" height="20" alt="Showcase Key Tag" /></a>'
		frst.innerHTML = '<a href="javascript:void(0);" onclick="updateTop(\'frst\',\''+params+'\')"><img class="or" src="/amsterdam/pict/mug_tab.gif" width="157" height="20" alt="Digital Ceramic Mug" /></a>'
		if (thrdnav != null && scndnav != null && frstnav != null) {
			frstnav.style.display = 'none'
			scndnav.style.display = 'none'
			thrdnav.style.display = 'block'
		}
		categ = gfirst
		setTimeout ( "updateTopTimer('frst','f1|s1|t1|f1,f4,f3,f2,s4,s1,s3,s2')", 5000 );
	} 
	
	
	if (conf == "scnd") {
		scnd.innerHTML = '<img class="blue" src="/amsterdam/pict/magnet_tab1.gif" width="157" height="20" alt="Showcase Key Tag" />'
		thrd.innerHTML = '<a href="javascript:void(0);" onclick="updateTop(\'thrd\',\''+params+'\')"><img class="or" src="/amsterdam/pict/budgetpro_tab.gif" width="157" height="20" alt="Digital Budget Pro Wall Calendar" /></a>'
		frst.innerHTML = '<a href="javascript:void(0);" onclick="updateTop(\'frst\',\''+params+'\')"><img class="or" src="/amsterdam/pict/mug_tab.gif" width="157" height="20" alt="Digital Ceramic Mug" /></a>'
		if (scndnav != null && frstnav != null) {
			frstnav.style.display = 'none'
			scndnav.style.display = 'block'
			thrdnav.style.display = 'none'
		}
		categ = wfirst
		setTimeout ( "updateTopTimer('thrd','f1|s1|t1|f1,f4,f3,f2,s4,s1,s3,s2')", 5000 );
		
	} 
	
	else if (conf == "frst") {
		frst.innerHTML = '<img class="blue" src="/amsterdam/pict/mug_tab1.gif" width="157" height="20" alt="Devall Pen" />'
		scnd.innerHTML = '<a href="javascript:void(0);" onclick="updateTop(\'scnd\',\''+params+'\')"><img class="or" src="/amsterdam/pict/magnet_tab.gif" width="157" height="20" alt="Showcase Key Tag" /></a>'
		thrd.innerHTML = '<a href="javascript:void(0);" onclick="updateTop(\'thrd\',\''+params+'\')"><img class="or" src="/amsterdam/pict/budgetpro_tab.gif" width="157" height="20" alt="Digital Budget Pro Wall Calendar" /></a>'
		if (frstnav != null && scndnav != null) {
			scndnav.style.display = 'none'
			frstnav.style.display = 'block'
			thrdnav.style.display = 'none'
		}
		categ = efirst
		setTimeout ( "updateTopTimer('scnd','f1|s1|t1|f1,f4,f3,f2,s4,s1,s3,s2')", 5000 );
		
	}

	updateMid(categ,"",allcateg)

}

function updateMid(categ, text, allcateg)
{
	
	var activeLinks = getElementsByClassName("active",'li')
	if (activeLinks != null) {
		for (i = 0; i < activeLinks.length; i++) {
			activeLinks[i].innerHTML = '<a href="javascript:void(0);" onClick="updateMid(\''+activeLinks[i].id.substring(2)+'\',\''+activeLinks[i].innerHTML+'\',\''+allcateg+'\');">'+activeLinks[i].innerHTML+'</a>';
			activeLinks[i].className = "inactive";
		}
	}
	
	var activeItem = getElementsByClassName("activeit",'li')
	if (activeItem != null) {
		for (i = 0; i < activeItem.length; i++) {
			activeItem[i].className = "inactive";
		}
	}
	
	ele = document.getElementById('l_'+categ);
	cell = document.getElementById('c_'+categ);
	
	if (ele != null) {
		ele.className = "active";
		cell.className = "activeit";
		ele.style.paddingLeft = '5px'
		ele.style.paddingRight = '5px'
		if (text == "") {
			y = ele.innerHTML.indexOf('>')
			if (y > -1) {
				temp = ele.innerHTML.substr(y+1);
				z = temp.indexOf('<');
				temp = temp.substr(0,z);
				ele.innerHTML = temp;
			}
		} else {
			ele.innerHTML = text;
		}
	}

}







function getElementsByClassName(cl,type) {
	var retnode = new Array();
	var myclass = new RegExp('\\b'+cl+'\\b');
	var elem = document.getElementsByTagName(type);
	for (var i = 0; i < elem.length; i++) {
		var classes = elem[i].className;
		if (myclass.test(classes)) retnode.push(elem[i]);
	}
	return retnode;
}
function acswap(acid)
{
	var acimg = document.getElementById(acid).src;
   	newnameimg = acimg.replace(".jpg","_a.jpg")
	newnameimg = newnameimg.replace(".gif","_a.gif")
	document.getElementById(acid).src = newnameimg;
}
function acback(acidv)
{
	var acimgv = newnameimg;
   	newnameimgv = acimgv.replace("_a.jpg",".jpg")
	newnameimgv = newnameimgv.replace("_a.gif",".gif")
	document.getElementById(acidv).src = newnameimgv;
}

//this function opens a new window
// when the url, width, height, and position of the window is provided
function OpenWindow(URL,w,h,px,py)
{
 mywindow = window.open(URL,"mywindow","resizable,location=1,status=1,scrollbars=1,width="+ w + ",height=" + h)
 mywindow.moveTo(px,py)
 } 
/* this function takes a text box as an argument
it varifies its value if empty generates an error message
if not ask to confirm if the user is sure to make the changes
*/

/*function that ties the next available button control to the textbox a user pressed enter key in*/
function checkReturn(obj, windowEv, ev) {

    var workingEvent = null;

    if (windowEv != null) workingEvent = windowEv;
    else if (ev != null) workingEvent = ev;

    if (workingEvent.keyCode == 13 || workingEvent.which == 13) {
        var form = window.document.forms[0];
        var clicknext = false;
        var nextobj;
        for (var i = 0; i < form.elements.length; i++) {
            if (form.elements[i] == obj) clicknext = true;

            if (clicknext) {
                nextobj = form.elements[i];
                if (nextobj.type.toUpperCase() == "BUTTON" || nextobj.type.toUpperCase() == "SUBMIT") {
                    nextobj.focus();
                    var ua = navigator.userAgent;
                    if (/trident/ig.test(ua) || /presto/ig.test(ua)) { // IE or opera
                        nextobj.click();
                    }
                    else {    // other browsers that do not support calling click() directly
                        var newEvent = document.createEvent("MouseEvents");
                        newEvent.initEvent("click", true, true);
                        nextobj.dispatchEvent(newEvent);
                        ev.preventDefault();
                    }
                    break;
                }
            }
        }
        return false;
    }
    return true;
}

function Form1_onsubmit(box) {
if(box.value=="")
	{ 
	alert("A required field found empty")
	box.focus()
	return (false)
	}
else {
	if(confirm("are you shure you want to make changes"))
		return(true)
	else 
		return(false)
	}
}
/*this functions takes a stirng  and checks if its value is numeric or not return value is 
boolean true or false
function IsNumeric(sText)
{
var ValidChars="0123456789"
var Char
var IsNumber=true
 if(sText.length==0)
	{
	return false
	}
   for (i = 0; i < sText.length && IsNumber == true; i++) 
      { 
      Char = sText.charAt(i) 
      if (ValidChars.indexOf(Char) == -1) 
         {
         IsNumber = false
         }
      }
   return IsNumber
   }*/

/*this functions takes a controle checks its value and if null error
if not numeric error other wise disable it
function ValidateBox(box)
{
	if(box.text=="")
	{
		alert("Pleas enter number of headings")
		box.focus()
		return (false)
	}
	//else if(isNumeric(box.text))
	//	return (true)
	else
	{
		alert("Please enter a numeric value")
		box.focus()
		return (false)
	}
}
*/
