/* copyright 2002 - 2005 Avestanet
   free to use and alter; must include this header and all comments */

//author: Ed Lebedev
//Date: Nov. 28, 2004
//Last modified on: Dec. 27, 2005

////////////////////////////////////////////////////////////////////////////////////
	var i, j;
	var theDay = 0;
	var theMonth = 0;
	var dater = new Date();
	var myYear = dater.getFullYear();
	var myMonth = dater.getMonth();
	var myDay = dater.getDay();
	var myDate = dater.getDate();

	var num1 = myDay;
	var num2 = myMonth;


function dateMe() {

	

	dayName = new Array(7);
	dayName[0] = "Sunday";
	dayName[1] = "Monday";
	dayName[2] = "Tuesday";
	dayName[3] = "Wednesday";
	dayName[4] = "Thursday";
	dayName[5] = "Friday";
	dayName[6] = "Saturday";

	monthName = new Array(12);
	monthName[0] = "January";
	monthName[1] = "February";
	monthName[2] = "March";
	monthName[3] = "April";
	monthName[4] = "May";
	monthName[5] = "June";
	monthName[6] = "July";
	monthName[7] = "August";
	monthName[8] = "September";
	monthName[9] = "October";
	monthName[10] = "November";
	monthName[11] = "December";

	for(i =0; i < 7; i++) {
		if(num1 == i)
			theDay = dayName[i];
	}

	for(j =0; j < 12; j++) {
		if(num2 == j)
			theMonth = monthName[j];
	}

	document.write(theDay + ", " + theMonth +" "+ myDate +", "+ myYear);

}

////////////////////////////////////////////////////////////////////////////////////

function footer() {
	
	// document.write("......................................................................................................................................................................................................" + "<br />" );
	document.write("Copyright &#169; " + myYear + " missmymy.com - All Rights Reserved. &nbsp;&nbsp;&nbsp; All Code and Template Design &#169; " + myYear + " <a href=\"http://www.avestanet.ca\" class=\"copy\" target=\"_blank\" title=\"Miss MyMy: Template design by AvestaNet\">AvestaNet</a>");
}

function enterFooter() {
	document.write("Copyright &#169; " + myYear + " missmymy.com - All Rights Reserved. &nbsp;&nbsp;&nbsp; All Code and Template Design &#169; " + myYear + " <a href=\"http://www.avestanet.ca\" class=\"copyEnter\" target=\"_blank\" title=\"Miss MyMy: Template design by AvestaNet\">AvestaNet</a>");
}

////////////////////////////////////////////////////////////////////////////////////
//
// helper functions....

//swap thumbnail with enlarged prod shot

function changeImage(tdId, state, prodID, prodColor) {

	var dirtyNum = tdId;
	var cleanNum = 0;
	var adjecentId = 0;
	var startLength = 5; //'prod_' takes up 0-4
	var stopLength = dirtyNum.length - 1;
	
	cleanNum = dirtyNum.substr(startLength, stopLength);
	cleanNum = parseInt(cleanNum) + 1;
	adjecentId = "prod_" + cleanNum;
	
	if(state == "detail") {
		eval("document.getElementById('" + tdId + "').innerHTML='<img src=\"images/d_" + prodID + "s_" + prodColor + ".gif\" alt=\"\" width=\"225\" height=\"225\" border=\"0\">'");
		eval("document.getElementById('" + adjecentId + "').innerHTML='<a onclick=javascript:changeImage(\"" + tdId + "\",\"thumb\",\"" + prodID + "\",\"" + prodColor + "\")><img src=\"images/btn_shrink_image.gif\" alt=\"Shrink Image\" width=\"136\" height=\"27\" border=\"0\" style=\"cursor: hand; cursor: pointer;\"></a>'");
	}else {
		eval("document.getElementById('" + tdId + "').innerHTML='<img src=\"images/t_" + prodID + "s_" + prodColor + ".gif\" alt=\"\" width=\"100\" height=\"100\" border=\"0\">'");
		eval("document.getElementById('" + adjecentId + "').innerHTML='<a onclick=javascript:changeImage(\"" + tdId + "\",\"detail\",\"" + prodID + "\",\"" + prodColor + "\")><img src=\"images/btn_enlarge_image.gif\" alt=\"Enlarge Image\" width=\"136\" height=\"27\" border=\"0\" style=\"cursor: hand; cursor: pointer;\"></a>'");
	}
	
}


////////////////////////////////////////////////////////////////////////////////////
//
// 
//hide and show the colour chart

	
	// Hide the Colour Chart
	function hideLayer(whichLayer) {

		if (document.getElementById) {
			document.getElementById(whichLayer).style.visibility = "hidden";
		} 
		
		else if (document.all) {
			document.all[whichlayer].style.visibility = "hidden";
		}
		
		else if (document.layers) {
			document.layers[whichLayer].visibility = "hidden";
		}

	}

	// Show the Colour Chart
	function showLayer(whichLayer) {

		if (document.getElementById) {
			document.getElementById(whichLayer).style.visibility = "visible";
		}
		
		else if (document.all) {
			document.all[whichlayer].style.visibility = "visible";
		}
	
		else if (document.layers) {
			document.layers[whichLayer].visibility = "visible";
		}

	}

	
	// Function Call
	function handleClick(whichClick) {

		if (whichClick == "hide it") {
			hideLayer("colourchart");
		}
		
		else if (whichClick == "show it") {
			showLayer("colourchart");
		}

	}
	
	function handleClick2(whichClick) {

		if (whichClick == "hide it") {
			hideLayer("density");
		}
		
		else if (whichClick == "show it") {
			showLayer("density");
		}

	}
	
	function handleClick3(whichClick) {

		if (whichClick == "hide it") {
			hideLayer("installation");
		}
		
		else if (whichClick == "show it") {
			showLayer("installation");
		}

	}
	
	function handleClick4(whichClick) {

		if (whichClick == "hide it") {
			hideLayer("hairtexture");
		}
		
		else if (whichClick == "show it") {
			showLayer("hairtexture");
		}

	}

	function handleClick5(whichClick) {

		if (whichClick == "hide it") {
			hideLayer("press1");
		}
		
		else if (whichClick == "show it") {
			showLayer("press1");
		}

	}

	function handleClick6(whichClick) {

		if (whichClick == "hide it") {
			hideLayer("press");
		}
		
		else if (whichClick == "show it") {
			showLayer("press");
		}

	}

	function handleClick7(whichClick) {

		if (whichClick == "hide it") {
			hideLayer("press2");
		}
		
		else if (whichClick == "show it") {
			showLayer("press2");
		}

	}
	
	function handleClick8(whichClick) {

		if (whichClick == "hide it") {
			hideLayer("press3");
		}
		
		else if (whichClick == "show it") {
			showLayer("press3");
		}

	}


	// move the Colour Chart
	function moveLayer(id, top_value) {

		if (document.getElementById) {
			document.getElementById(id).style.top = top_value;
			
		}
		
		else if (document.all) {
			document.all[id].style.top = top_value;
			
		}
	
		else if (document.layers) {
			document.layers[id].top = top_value;
			
		}

	}
	
//this is off the Internet
//a special thanks to Ken Ward and his free downloadable code at: 
// http://www.trans4mind.com/personal_development/JavaScript/Doublemenu.htm
// we wish him a speedy recovery! :)

//this code changes menus

function nullOptions(aMenu) {

	var tot = aMenu.options.length;
	
	for(i = 0; i < tot; i++) {
		aMenu.options[i] = null;
	}
	
	aMenu.options.length = 0;
	
} //nullOptions


var pagesToGo = new Array("","virgin_machine_mc11","virgin_hand_hmc11","virgin_bulk_bu11");


function Category01(aMenu, menuID) {

	nullOptions(aMenu);

	tempURL = pagesToGo[menuID];
	
	with(aMenu) {
		//Rewrites the text and values
		options[0] = new Option("Select a hair type:","no");
		options[1] = new Option("  Straight", tempURL + ".html#asian_st");
		options[0].selected = true;
	}
	
	//Netscape likes a refresh, but Microsoft doesn't
	if (navigator.appName.indexOf("Netscape") > -1)
		history.go(0);
		
} //Category01

function Category02(aMenu, menuID) {

	nullOptions(aMenu);

	tempURL = pagesToGo[menuID];
	
	with(aMenu) {
		//Rewrites the text and values
		options[0] = new Option("Select a hair type:","no");
		options[1] = new Option("  Straight", tempURL + ".html#indian_st");
		options[2] = new Option("  Curly", tempURL + ".html#indian_cu");
		options[0].selected = true;
	}
	
	//Netscape likes a refresh, but Microsoft doesn't
	if (navigator.appName.indexOf("Netscape") > -1)
		history.go(0);
		
} //Category02

/* ####################### changeFiles ####################### */

function changeFiles(menuID){

	if(menuID == 1) {
		aMenu = document.userSelection.category1;
		aMenu2 = document.userSelection.topic1;
	} else if(menuID == 2) {
		aMenu = document.userSelection.category2;
		aMenu2 = document.userSelection.topic2;
	} else if(menuID == 3) {
		aMenu = document.userSelection.category3;
		aMenu2 = document.userSelection.topic3;
	}

	with(aMenu) {
		switch(selectedIndex) {   
			
			case 0:  
				Category01(aMenu2); 
				aMenu2.options.length = 0;
				aMenu2.options[0] = new Option("-----------------------------------","no");
				aMenu2.options[0].selected = true;
				//history.go(0)
			break;
			
			case 1:  
				Category01(aMenu2, menuID);
			break;
			
			case 2:  
				Category02(aMenu2, menuID);
			break;      

		} //switch
	} //with
	
} //changeFiles()

function jumpTo(menuID) {

if(menuID == 1) {

	
	
	if(userSelection.topic1.value != "no") {
		//alert(userSelection.topic1.value);
		location = userSelection.topic1.value;
	}else {
		if(userSelection.category1.selectedIndex == 0) {
			location = "#";
		}else if(userSelection.topic1.selectedIndex == 0) {
			location = "#";
		}
	}//block 1
} else if(menuID == 2) {

	

	if(userSelection.topic2.value != "no") {
		//alert(userSelection.topic2.value);
		location = userSelection.topic2.value;
	}else {
		if(userSelection.category2.selectedIndex == 0) {
			location = "#";
		}else if(userSelection.topic2.selectedIndex == 0) {
			location = "#";
		}
	}//block 2
} else if(menuID == 3) {
	if(userSelection.topic3.value != "no"){
		//alert(userSelection.topic3.value);
		location = userSelection.topic3.value;
	}else {
		if(userSelection.category3.selectedIndex == 0) {
			location = "#";
		}else if(userSelection.topic3.selectedIndex == 0) {
			location = "#";
		}
	}//block 3
}
	
	
	
} //jumpTo()

//-->





/* ####################### pop-up window(s) ####################### */

function CreateWindow(action, height, width, pic) {

	var str = 'height=' + height + ',innerHeight=' + height;
	str += ',width=' + width + ',innerWidth=' + width;

	if (window.screen) {
		var ah = screen.availHeight - 32;
		var aw = screen.availWidth - 12;
		var xc = (aw - width) / 2;
		var yc = (ah - height) / 2;
		str += ',left=' + xc + ',screenX=' + xc;
		str += ',top=' + yc + ',screenY=' + yc;
		str += ',status=no';
		str += ',scrollbars=no';
	}

	mywindow=window.open('','mywindow', str)
		mywindow.document.writeln('<html>')
		mywindow.document.writeln(' <head>')
		mywindow.document.writeln('  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />')
		mywindow.document.writeln('  <title>Miss MyMy</title>')
		mywindow.document.writeln(' </head>')
		
			if (pic == '3') 
			mywindow.document.writeln(' <body bgcolor="#669999" background="images/baa_pop_up_003.jpg" topmargin="0" leftmargin="0" marginwidth="0" marginheight="0">')
			else if (pic == '2')
			mywindow.document.writeln(' <body bgcolor="#669999" background="images/baa_pop_up_002.jpg" topmargin="0" leftmargin="0" marginwidth="0" marginheight="0">')
			else if (pic == '1')
			mywindow.document.writeln(' <body bgcolor="#669999" background="images/baa_pop_up_001.jpg" topmargin="0" leftmargin="0" marginwidth="0" marginheight="0">')
			
		mywindow.document.writeln('  <table width="100%" height="100%" background="images/pop.gif" cellpadding="12" cellspacing="0" border="0">')
		mywindow.document.writeln('   <tr >')
		mywindow.document.writeln('   <td  valign="bottom" align="center"><a href="#" onclick="window.close()"><img src="images/close_button.gif" alt="Click here to close window" width="131" height="21" border="0" /></td>')
		mywindow.document.writeln('  </tr>')
		mywindow.document.writeln('  </table>')
		mywindow.document.writeln(' </body>')
		mywindow.document.writeln('</html>')
		mywindow.document.close()
		window.mywindow.focus()
}