/**
 * Generic Site Functions
 */
/**
 * Used in /contact/
 */
function HearAboutUs_Change(block){
	if (document.getElementById("hearaboutus"+block+"").value==""){document.getElementById("block"+block+"").style.display="none";}
	if (document.getElementById("hearaboutus"+block+"").value=="Advertisement"){document.getElementById("block"+block+"").style.display="block";}
	if (document.getElementById("hearaboutus"+block+"").value=="Media Coverage"){document.getElementById("block"+block+"").style.display="block";}
	if (document.getElementById("hearaboutus"+block+"").value=="Previous Client"){document.getElementById("block"+block+"").style.display="block";}
	if (document.getElementById("hearaboutus"+block+"").value=="Search Engine"){document.getElementById("block"+block+"").style.display="block";}	
	if (document.getElementById("hearaboutus"+block+"").value=="Reference"){document.getElementById("block"+block+"").style.display="block";}
	if (document.getElementById("hearaboutus"+block+"").value=="Speaking Event"){document.getElementById("block"+block+"").style.display="block";}
	if (document.getElementById("hearaboutus"+block+"").value=="Other..."){document.getElementById("block"+block+"").style.display="block";}	
}

function countryUpdate(country, block) {
	if(country.value == "United States" || country.value == "Canada") {
		document.getElementById(""+block+"").style.visibility = "visible";
	}else{
		document.getElementById(""+block+"").style.visibility = "hidden";
	}

}
	
/* Used in multiple areas to show/hide divs */
var listx = new Array();

function hidediv(pass) {
	var divs = document.getElementsByTagName('div');
	for(i = 0; i < divs.length; i++) {
		if (divs[i].id == (pass)) {
			if (document.getElementById) // DOM3 = IE5, NS6
				divs[i].style.display = 'none';
			else {
				if (document.layers) {
					document.layers[divs[i]].display = 'none';
					document.layers[divs[i]].position = 'absolute';
				}
				else {
					document.all.hideShow.divs[i].visibility = 'none';
					document.all.hideShow.divs[i].position = 'absolute';
				}
			}
		}
	}
	
	listx[pass] = "hidden";
}
function showdiv(pass) {
	if (listx[pass] == "shown") hidediv(pass);
	else {
		var divs = document.getElementsByTagName('div');
		
		for(i = 0; i < divs.length; i++) {
			if (divs[i].id == (pass)) {
				if (document.getElementById) {
					// IE 6+/NN6
					divs[i].style.display = 'block';
				}
				else {
					if (document.layers) {
						//netscape 5
						document.layers[divs[i]].display = 'block';
						document.layers[divs[i]].position = 'relative';
					}
					else {
						// IE 4 and 5 not 5+
						document.all.hideShow.divs[i].visibility = 'block';
						document.all.hideShow.divs[i].position = 'relative';
					}
				}
			}
		}
		listx[pass] = "shown";
	}
}

	

// This is used to embed Flash documents, because Internet Explorer sucks
function embedFlash(src, width, height) {
	document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="https://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="'+width+'" height="'+height+'">');
    document.write('<param name="movie" value="/common/flash/'+src+'" />');
    document.write('<param name="quality" value="high" />');
	document.write('<param name="wmode" value="transparent" />');
    document.write('<embed src="/common/flash/'+src+'" quality="high" wmode="transparent" pluginspage="https://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="'+width+'" height="'+height+'"></embed>');
	document.write('</object>');
}

var tls = null;
var inout = -1;

function fadeTimeout(cnt, op) {
	tls[cnt].style.opacity = parseFloat(op);
	//alert(tls[cnt].style.opacity);
}
function fadeElms() {	
	tls = document.getElementsByTagName('DIV');
	
	var time = 0;

	if (inout < 0) {	
		for (var op = 1.000; op >= 0.000; op -= 0.100) {
		time += 100;
			for (i = 0; i < tls.length; i++) {
				var cmd = "fadeTimeout("+i+", "+op+");";
				//alert(cmd);
				
				window.setTimeout(cmd, time);
			}
		}
	}
	else {
		for (var op = 0.000; op <= 1.000; op += 0.100) {
		time += 100;
			for (i = 0; i < tls.length; i++) {
				var cmd = "fadeTimeout("+i+", "+op+");";
				//alert(cmd);
				
				window.setTimeout(cmd, time);
			}
		}
	}
	inout = -inout;
}


/* Admin Stuff */
function remove(id, method) {
	document.getElementById("hdnID").value = id;
	document.getElementById("hdnAction").value = 'del'+method;
	var path = confirm("Really remove entry? \n(note: Removing categories will remove all entries within)");
	if(path == true) {
		document.adminForm.submit();
	}else{
		return false;
	}
}	