/* this is the most current 
http://www.patrickssite.com/6stepweightloss/6StepFinal/ 
http://www.crownpointmed.com/
*/

function MM_preloadImages()
{ //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}}


function create_center_content(p)
{

	var ccc = new Array();
	
	 ccc[0] = "home";
	 ccc[1] = "about";
	 ccc[2] = "6step";
	 ccc[3] = "products";
	 ccc[4] = "media";
	 ccc[5] = "testimonials";
	 ccc[6] = "publications";
	 ccc[7] = "inthenews";	 
	 ccc[8] = "food";
	 ccc[9] = "grocerylist";
	 ccc[10] = "recipes";
	 ccc[11] = "physicians";	
	 ccc[12] = "contact";
	 ccc[13] = "privacy";
	 ccc[14] = "terms";
	 ccc[15] = "copyright";
	 ccc[16] = "disclaimer";
	 ccc[17] = "sitemap";
	 // recipes menu starts
	 ccc[18] = "p_pizza";
	 ccc[19] = "p_kebabs";
	 ccc[20] = "p_okra";
	 ccc[21] = "p_eggsalad";
	 ccc[22] = "p_pesto";
	 ccc[23] = "p_jeddah";
	 ccc[24] = "p_lemonfish";
	 ccc[25] = "p_ministrone";
	 ccc[26] = "p_cparm";
	 ccc[27] = "p_marinara";
	 ccc[28] = "p_roastag";
	 ccc[29] = "p_";
	 ccc[30] = "p_";
	 ccc[31] = "p_";
	 ccc[32] = "p_";
	 ccc[33] = "p_";
	 ccc[34] = "p_";
	 ccc[35] = "p_";
	 ccc[36] = "p_";
	 ccc[37] = "p_";
	 ccc[38] = "p_";
	 // products menu starts
	 ccc[39] = "p_togs";
	 ccc[40] = "p_crunch";
	 ccc[41] = "p_crunchos";
	 ccc[42] = "p_fatburn";
	 ccc[43] = "p_guar";
	 ccc[44] = "p_ptwist";
	 ccc[45] = "p_shake";
	 ccc[46] = "p_wldvd";
	 ccc[47] = "p_skinny";
	 ccc[48] = "p_fishoil";
	 ccc[49] = "p_appsupp";
	 ccc[50] = "p_chcake";
	 ccc[51] = "p_brochure";
	 ccc[52] = "p_mixdrink";
	 ccc[53] = "p_cinnswirl";
	 ccc[54] = "p_";
	 ccc[55] = "p_";
	 ccc[56] = "p_";
	 ccc[57] = "p_";
	 ccc[58] = "p_";
	 ccc[59] = "p_";
	 
	 
if(p != 12 && p<=17)
{	
var oldDiv = document.getElementById("inside_content_container");										

var newDiv = document.createElement("script");															

newDiv.setAttribute('type', 'text/javascript');															

oldDiv.appendChild(newDiv);																				

newDiv.src = 'http://www.crownpointmed.com/php/subpages/' + ccc[p] + '.php';			

newDiv.innerHTML;
}

else if(p > 17 && p<=38)
{	
var oldDiv = document.getElementById("li_insert");

oldDiv.style.visibility = "visible";

oldDiv.style.backgroundColor = "#fff";										

var newDiv = document.createElement("script");															

newDiv.setAttribute('type', 'text/javascript');															

oldDiv.appendChild(newDiv);																				

newDiv.src = 'http://www.crownpointmed.com/php/subpages/productsrecipes/' + ccc[p] + '.php';			

newDiv.innerHTML;
}

else if(p > 38 && p<=59)
{	
var oldDiv = document.getElementById("li_insert2");	

oldDiv.style.visibility = "visible";

oldDiv.style.backgroundColor = "#fff";									

var newDiv = document.createElement("script");															

newDiv.setAttribute('type', 'text/javascript');															

oldDiv.appendChild(newDiv);																				

newDiv.src = 'http://www.crownpointmed.com/php/subpages/productsrecipes/' + ccc[p] + '.php';			

newDiv.innerHTML;
}

else
{
var oldDiv = document.getElementById("inside_content_container");										

oldDiv.style.cssFloat = "left";

oldDiv.style.position = "relative";

oldDiv.style.width = "872px";

var newDiv = document.createElement("script");															

newDiv.setAttribute('type', 'text/javascript');															

oldDiv.appendChild(newDiv);																				

newDiv.src = 'http://www.crownpointmed.com/php/subpages/' + ccc[p] + '.php';			

newDiv.innerHTML;

}
}

function mouseIf(h,g) 
{

var dg = new Array;

dg[0]  = "";
dg[1]  = "tabb1";
dg[2]  = "tabb2";
dg[3]  = "tabb3";
dg[4]  = "tabb4";
dg[5]  = "tabb5";
dg[6]  = "tabb6";
dg[7]  = "tabb7";
dg[8]  = "tabb8";
dg[9]  = "tabb9";
dg[10]  = "tabb10";
dg[11]  = "tabb11";

 
var fd = document.getElementById(dg[h]).style;

if(g != 0)
{

	if(h <= 3) 
	{										
		if(h == 1) // 1,1
		{
		
			fd.backgroundColor = "#eebd3f";
			document.getElementById(dg[2]).style.backgroundColor = "";
			document.getElementById(dg[3]).style.backgroundColor = "";
		}
		else if(h == 2) // 2,1
		{
			
			 fd.backgroundColor = "#eebd3f";
			 document.getElementById(dg[3]).style.backgroundColor = "";
			 document.getElementById(dg[1]).style.backgroundColor = "";
			
			
		}
		else if(h == 3) // 3,1
		{
		
			 fd.backgroundColor = "#eebd3f";
			 document.getElementById(dg[2]).style.backgroundColor = "";
			 document.getElementById(dg[1]).style.backgroundColor = "";

		}
	}
	else if (h>3&&h<=7) 
	{										
		if(h == 4) // 4,1	
		{
		
			fd.backgroundColor = "#eebd3f";
			document.getElementById(dg[5]).style.backgroundColor = "";
			document.getElementById(dg[6]).style.backgroundColor = "";
			document.getElementById(dg[7]).style.backgroundColor = "";	
		}
		else if(h == 5) // 5,1
		{
		
			fd.backgroundColor = "#eebd3f";
			document.getElementById(dg[4]).style.backgroundColor = "";
			document.getElementById(dg[6]).style.backgroundColor = "";
			document.getElementById(dg[7]).style.backgroundColor = "";
		}
		else if(h == 6) // 6,1	
		{
		
			fd.backgroundColor = "#eebd3f";
			document.getElementById(dg[4]).style.backgroundColor = "";
			document.getElementById(dg[5]).style.backgroundColor = "";
			document.getElementById(dg[7]).style.backgroundColor = "";
		}
		else if(h == 7) // 7,1
		{
		
			fd.backgroundColor = "#eebd3f";
			document.getElementById(dg[4]).style.backgroundColor = "";
			document.getElementById(dg[5]).style.backgroundColor = "";
			document.getElementById(dg[6]).style.backgroundColor = "";
		}
	}
	else 
	{
	fd.style.backgroundImage="";alert("i ended");	
	}
}

}



function mouseIfproduct(x,z,y,w) // x is for the loop, z is condition, and y is for array index number, w is for which menu
{
var a = new Array()
a[0]="pro";
a[1]="rec";

var d = document.getElementById(a[w]+'sdiv1');

var c = d.getElementsByTagName("LI"); 

var f = new Array();  

if(!isNaN(x))
{

for(i=x;i<c.length;i++)	f.push(c[x++].id);	

if(z==0)
{	

	var g = document.getElementById(f[y]).style;
	
	var d = document.getElementById(a[w]+'sdiv1');
			
	var dd = d.getElementsByTagName("LI");  
	
	for(j=0;j<dd.length;j++) dd[j].style.backgroundImage="";
	
	g.backgroundImage="";
	
	alert("all else fails");
}
else
{	
	var g = c[y].className;
	
	if(g=="firstli") 
	{
		
		var d = document.getElementById(a[w]+'sdiv1');
			
		var dd = d.getElementsByTagName("LI"); 
	
		for(j=0;j<dd.length;j++) dd[j].style.backgroundImage="";
		
		dd[y].style.backgroundImage="url(imgs/orangemenutopon.png)";  
		
		
	
	}
	else if(g=="lastli")
	{
		
		var d = document.getElementById(a[w]+'sdiv1');
			
		var dd = d.getElementsByTagName("LI"); 
	
		for(j=0;j<dd.length;j++) dd[j].style.backgroundImage="";
		
		dd[y].style.backgroundImage="url(imgs/orangemenuboton.png)"; 
		
		
	
	}
	else
	{
		
		var d = document.getElementById(a[w]+'sdiv1');
			
		var dd = d.getElementsByTagName("LI"); 
	
		for(j=0;j<dd.length;j++) dd[j].style.backgroundImage="";
		
		dd[y].style.backgroundImage="url(imgs/orangemenumidon.png)"; 
		
	}

}
}
}



function menuchange(n,r) 
{
	var a = document.getElementById("rock_menu");
	var b = document.getElementById("media_sub");
	var c = document.getElementById("food_sub");
	var d = document.getElementById("cart");

	var img = new Array();

		img[0] =  "imgs/rockz.png";
		img[1] =  "imgs/rock1.png";
		img[2] =  "imgs/rock2.png";
		img[3] =  "imgs/rock3.png";
		img[4] =  "imgs/rock4.png";
		img[5] =  "imgs/rock5.png";
		img[6] =  "imgs/rock6.png";
		img[7] =  "imgs/rock7.png";
		img[8] =  "imgs/medias.png";
		img[9] =  "imgs/media1.png";
		img[10] = "imgs/media2.png";
		img[11] = "imgs/media3.png";
		img[12] = "imgs/foods.png";
		img[13] = "imgs/food1.png";
		img[14] = "imgs/food2.png";
		img[15] = "imgs/cartoff.png";
		img[16] = "imgs/carton.png";
	
	if (r==0)
	{
	if (a.src.indexOf(img[n])!= 0) a.src = img[n];
	else a.src = img[0];
	}
	else 
	if (r==1)
	{
	if (b.src.indexOf(img[n])!= 8) b.src = img[n];
	else b.src = img[8];	
	}
	else 
	if (r==2)
	{
	if (c.src.indexOf(img[n])!= 12) c.src = img[n];
	else c.src = img[12];	
	}
	if (r==3)
	{
	if (d.src.indexOf(img[n])!= 15) d.src = img[n];
	else d.src = img[15];	
	}	
}

function fill_in(m)
{
	var f = document.getElementById('description_p');
	
	var filled = new Array();
	
	 filled[0] = "&nbsp;";
	 filled[1] = "This will take you back to the Homepage";
	 filled[2] = "Learn about Crownpoint Family Practice and Bariatric Medicine";
	 filled[3] = "A summary of The 6 STEP Weight Loss Program";
	 filled[4] = "Online store for our weight loss products";
	 filled[5] = "Click for Media Submenu";
	 filled[6] = "Testimonials from program users";
	 filled[7] = "Publications";
	 filled[8] = "Our Program in the news";
	 filled[9] = "Our 6-STEP Approved Recipes";
	filled[10] = "Need help at the grocery store, here is where you can get that help";
	filled[11] = "6-Step Program Approved Recipes";
	filled[12] = "About the professional staff";
	filled[13] = "Here you can get directions to our clinic, and other information";
	filled[14] = "View your cart here, the cart opens in a seperate window or tab";	
	
if (m!=0)
{
f.style.fontSize = "medium";
f.style.marginTop = "-2em";
}
else
{
f.style.fontSize = "85%";
f.style.marginTop = "0";
}

f.innerHTML = filled[m];
}

function show_submenu(n,v)
{
	var sub = new Array();

	sub[0] = "media_submenu";
	
	var d = document.getElementById(sub[n]).style;

	if(v == 1) 
	{
	
	d.display = "block";

	}else{
	
	d.display = "none";
	
	}
}

function showthediv(r,n)
{

	var de = document.getElementById("sixsdiv" + r).style;
	
	if(n != 0) 
	{
	
	de.display = "block";

	}else{
	
	de.display = "none";
	
	}
}

function showthedl2(y,t)
{
	var tiy = "aboudl"+y;
	var gr = document.getElementById(tiy).style;
	
	if(t != 0) 
	{
	
	gr.display = "block";

	}else{
	
	gr.display = "none";
	
	}

}

var gAutoPrint = true; // Tells whether to automatically call the print function

function printrecipe()
{

if (document.getElementById != null)
{
var html = '<HTML>\n<HEAD>\n';

if (document.getElementsByTagName != null)
{
var headTags = document.getElementsByTagName("head");
if (headTags.length > 0)
html += headTags[0].innerHTML;
}

html += '\n<STYLE>body{background: white; color: black; margin: 0 15em;}ul li{list-style-type:none; color: black; font-weight: normal;}h4.rechead{color:black; background-color:white;}h4.rechead a{visibility:hidden;}\n</STYLE>\n</HEAD>\n<BODY>\n<BR />\n';

var printReadyElem = document.getElementById("li_insert");

if (printReadyElem != null)
{
html += printReadyElem.innerHTML;
}
else
{
alert("Could not find the printReady function");
return;
}

html += '\n</BODY>\n</HTML>';

var printWin = window.open("","printrecipe");
printWin.document.open();
printWin.document.write(html);
printWin.document.close();
if (gAutoPrint)
printWin.print();
}
else
{
alert("The print ready feature is only available if you are using an browser. Please update your browswer.");
}
}
