/* a = which state the mouse is at, e.g ove this/over that
** b = the id of the element
** c
** d
*/
var tm01;
var tm02;
var pMenId;
var idOfThu;

/**
 *
 * @access public
 * @return void
 **/

function botMenFun(a, b, c, d) {

	//rollover state
	if (a == 1){
	 //alert(document.getElementById('pre_img_plc').innerHTML);
	 // b = the id of the thumb image
	 idOfThu = b;
	 clearTimeout(tm01);
	 document.getElementById('pre_img_plc').innerHTML = "<div id='ovr_flow_fx'><img src=\'../View/" + idOfThu + "\' height='321'></div>";
	 //alert(document.getElementById('pre_img_plc').innerHTML);
	 //alert(document.getElementById('pre_img_plc').innerHTML);
	 document.getElementById(pMenId).style.visibility = 'hidden';
	}
	//click state
	else if (a == 3) {
	 var a = 3;
	 // b = updown_men_$blahincr paragraph menu
	 // c = blah$blahincr which is the id of the invisibe input form element
     document.getElementById(b).style.visibility = 'visible';
     if (document.getElementById(d).innerHTML < 1){
     document.getElementById(c).value = Math.abs(document.getElementById(c).value) + 1;
	 document.getElementById(d).innerHTML = Math.abs(document.getElementById(d).innerHTML) + 1;
	 document.getElementById('no_of_ords').innerHTML = Math.abs(document.getElementById('no_of_ords').innerHTML) + 1;
	 document.getElementById('no_of_cost').innerHTML = Math.abs(document.getElementById('no_of_cost').innerHTML) + 20;
 	 }
	}
	//roll outstate
	else if (a == 2) {
	 // b = updown_men_$blahincr paragraph menu
	 pMenId = b;
	 tm01 = setTimeout("document.getElementById('pre_img_plc').innerHTML = '<p><strong><br /><br /><br /><br /><br /><br /><br />Click the images below to order.</strong><br /><br /></p><p><strong>To View: Move the mouse pointer over the image.</strong></p>';", 1000);
	 //tm02 = setTimeout("document.getElementById(pMenId).style.visibility = 'hidden';", 3000);
	}
	//roll over invisible menu state
	else if (a == 4) {
	 // b = updown_men_$blahincr paragraph menu
	 clearTimeout(tm02);
	 clearTimeout(tm01);
	 document.getElementById(b).style.visibility = 'visible';
	 document.getElementById('pre_img_plc').innerHTML = "<div id='ovr_flow_fx'><img src=\'../View/" + idOfThu + "\' height='321'></div>";
	}
}

/* this is the function that adds/removes the image from the 'cart' */
/* add image function */
function addImgFun(u, v, w , x) {


	// rollover state
	if (u == 1) {
		// w = the name of the image that is to replace the previous image fo the rollover effect
		// x = the id of the paragraph that goes invisible
		clearTimeout(tm02);
		document.getElementById(x).style.visibility = 'visible';
		document.getElementById(v).src = "imgs/interface_imgs/" + w;
	}
	// rollout state
	else if (u == 2) {
		document.getElementById(v).src = "imgs/interface_imgs/" + w;
	}
	// click up arrow state
	else if (u == 3) {
     document.getElementById(v).value = Math.abs(document.getElementById(v).value) + 1;
	 document.getElementById('no_of_ords').innerHTML = Math.abs(document.getElementById('no_of_ords').innerHTML) + 1;
	 document.getElementById(w).innerHTML = Math.abs(document.getElementById(w).innerHTML) + 1;
	 document.getElementById('no_of_cost').innerHTML = Math.abs(document.getElementById('no_of_cost').innerHTML) + 20;
	}
	// click down arrow state
	else if (u == 4 && document.getElementById(w).innerHTML!= 0) {
     document.getElementById(v).value = Math.abs(document.getElementById(v).value) - 1;
	 document.getElementById('no_of_ords').innerHTML = Math.abs(document.getElementById('no_of_ords').innerHTML) - 1;
	 document.getElementById(w).innerHTML = Math.abs(document.getElementById(w).innerHTML) - 1;
	 document.getElementById('no_of_cost').innerHTML = Math.abs(document.getElementById('no_of_cost').innerHTML) - 20;
	}
}
