
var atomzNo;
function setAtomzAccount(atomz){
	atomzNo = atomz;
}


setTimeout('setDivStyle();', 500);
function setDivStyle(){document.getElementById('divExpandable').style.display="none";}

function expand()
{
	if(document.getElementById('divExpandable').style.display=="block"){
        document.getElementById('divExpandable').style.display="none";
    }
    else {
		document.getElementById('divExpandable').style.display="block"
        document.getElementById('dropdownsDiv').focus();
    }
}

function retract()
{
	if(document.getElementById('divExpandable').style.display=="block"){
			document.getElementById('divExpandable').style.display="none";
	}
}

function clearSearch(searchBox){
	if(searchBox.value=='Search site...'){
		searchBox.value='';
	}
}

function checkkey(e)
{
	var characterCode;
	
	if(e && e.which){ //if which property of event object is supported (NN4)
		e = e
		characterCode = e.which //character code is contained in NN4's which property
	}
	else{
		e = event
		characterCode = e.keyCode //character code is contained in IE's keyCode property
	}

	if(characterCode == 13){ //if generated character code is equal to ascii 13 (if enter key)
		doSearch(atomzNo);
	}
}

function doSearch()
{
	var value = document.getElementById('searchsiteText').value;
	if((value!='Search site...')&&(value!='')){
		window.location.href = 'http://search.atomz.com/search/?sp-a='+atomzNo+'&sp-q=' + value;
	}
}

function restartText()
{
	document.getElementById('searchsiteText').value='Search site...';
}



document.onclick = function (e) {
	e = e || event
	var target = e.target || e.srcElement;
	var box = document.getElementById('dropdownsDiv');
	var detected = false;
	do {
		if (box == target) {
			detected = true;
			break;
		}
		target = target.parentNode
	} while (target && !detected)
	if(!detected){
		retract();
	}
}





