// JavaScript Document
function getLayer(id) {return (document.getElementById(id));}
//
function setarg(tf1)
{
	switchVisible('prodCategories',0);
	switchVisible('bottom',0);
	switchVisible('newFooter',0);
	//switchVisible('prodDisplaySection',1);
	//switchVisible('mainA',1);
	//switchVisible('mainB',1);
	proditem=tf1;
	FilterData(0);
	//alert("debug setarg:  proditem= "+proditem);
}
//function setarg2(tf1)
//{
	//proditem=tf1;
	//FilterData(0);
	//alert("debug setarg2:  proditem= "+proditem);
//}
function initDispl()
{
	switchVisible('prodCategories',1);
	switchVisible('bottom',1);
	switchVisible('newFooter',1);
	//switchVisible('prodDisplaySection',0);
	//switchVisible('mainA',0);
	//switchVisible('mainB',0);
}

function PrintItem(id,value)
{
	//alert(id+"  "+value);
	var newdiv = document.createElement("div");
	newdiv.innerHTML = value;
	var container = document.getElementById(id);
	container.appendChild(newdiv);
}
//        
/////////////
// Utilities
///////////////
function showTs(q,w,h)
{
//
	document.getElementById('base').setAttribute('src',q,'width',w,'height',h);
	ddrivetip('', '',w,h);
}
//
function showT(q,w,h)
{
	document.getElementById('base').setAttribute('src',q,'width',w,'height',h);
}
//
function switchVisible(id,viz)
{
	//if( (id==null) || (getLayer(id)==null) )alert("debug switchVisible:  id= "+id+" viz= "+viz );
	if(viz==0)getLayer(id).style.visibility="hidden";
	else getLayer(id).style.visibility="visible";
}

function ChangeSize(id,Size) {getLayer(id).style.fontSize = Size;}
//
function checkIt(theForm)
{
	var p = theForm.YourPhone.value;
	//alert('We are Debugging. Please excuse: Your Phone='+p +"  0="+p[0]+"  1="+p[1]+"  2="+p[2]+"  3="+p[3]+"  4="+p[4]+"  5="+p[5]+"  6="+p[6]+"  7="+p[7]+"  8="+p[8]+"  9="+p[9]+"  10="+p[10]+"  11="+p[11]+"  12="+p[10]+"  13="+p[11]);
	if(p[0]=="(" && p[1]=="0" && p[2]=="0" && p[3]=="0" && p[4]==")")
		{
			alert('Invalid Phone Number');
			return (false);
		}
	else if(p[0]=="(" && p[1]=="1" && p[2]=="1" && p[3]=="1" && p[4]==")")
		{
			alert('Invalid Phone Number');
			return (false);
		}
	else if(p[0]=="(" && p[1]=="2" && p[2]=="2" && p[3]=="2" && p[4]==")")
		{
			alert('Invalid Phone Number');
			return (false);
		}
	else if(p[0]=="(" && p[1]=="3" && p[2]=="3" && p[3]=="3" && p[4]==")")
		{
			alert('Invalid Phone Number');
			return (false);
		}
	else if(p[0]=="(" && p[1]=="4" && p[2]=="4" && p[3]=="4" && p[4]==")")
		{
			alert('Invalid Phone Number');
			return (false);
		}
	else if(p[0]=="(" && p[1]=="5" && p[2]=="5" && p[3]=="5" && p[4]==")")
		{
			alert('Invalid Phone Number');
			return (false);
		}
	else if(p[6]=="0" && p[7]=="0" && p[8]=="0")
		{
			alert('Invalid Phone Number');
			return (false);
		}
	else if(p[10]=="0" && p[11]=="0" && p[12]=="0"&& p[13]=="0")
		{
			alert('Invalid Phone Number');
			return (false);
		}
	else {return (true);}
}