// Standard JavaScript Functions


function c_prog(f_v){
	document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" id="c_swf" width="540" height = "760">');
	document.write('<param name="movie" value="http://www.myprotools.com/common/comPersonal/Custom.swf" />');
	document.write('<param name="quality" value="high" />');
	document.write('<param name="allowScriptAccess" value="always" />');
	document.write('<param name="FlashVars" value="' + f_v + '" />');
	document.write('<embed name="c_swf" scale="noscale" width="640" height = "760" quality="high" type="application/x-shockwave-flash" allowScriptAccess="always" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" src="http://www.myprotools.com/common/comPersonal/Custom.swf" FlashVars="' + f_v + '" ></embed>');
    document.write('</object>');

}

function call_alert(args) { 
		alert(args);
	}
	

function s_div(c, o) {
	gID('div' + c).style.display = "none";    
	gID('div' + o).style.display = "";    
	return false; 
 }

var opt = [];  // check Product Attribute Template of CSTM form to see how this is set.
var optchk=0;  // will be set to 1 if the product options include more than style (such as a quantity option) and the order form will include buttons for the additional option
var flash_ready=false;
var select_Data = 'xx';

function setStyle(slct, opt_index, company) {
    s_div(1,2);
	gID('flashObj').style.position='';
	aC([gID('div2'),gID('flashObj')]);
	gID('attvalue').value = opt[opt_index][0];  // sets the style selected as the attribute for the product.
	select_Data=slct +  ',' + opt[opt_index][1] + ',' + company + ',English2' ;
}

function set_flash_ready() {   // this is to let the browser know that flash is ready 
	flash_ready=true;
	return  select_Data;
}

function setAttrib(slct) {
    gID('attvalue2').value = slct;  // sets the style selected as the attribute for the product.
}

function setButtonOpts() {  // this is run if there is more than a style option (optchk = 1)
     if(optchk==0) {
			document.write('<input type="hidden" name="Product_Attribute_Count" value="1">');
			document.write('<input type="submit" class="largeFormButton" value="Place Order & Continue Shopping">');
	  } else {
		var optCode='';
       for(var x in opt) {  // this will ultimately have to deal with more than 1 additional option
		  if (opt[x][4] != "Style") {
				optCode = opt[x][4];
			}
		}
		document.write('<input type="hidden" name="Product_Attributes[2]:code" value="' + optCode + '">');
		document.write('<input id="attvalue2" type="hidden" name="Product_Attributes[2]:value" value="">');
       for(var i in opt) {
		  if (opt[i][4] != "Style") {
			document.write('<input type="hidden" name="Product_Attribute_Count" value="2">');
			document.write('<br><br><INPUT TYPE="submit" class="largeFormButton" VALUE="' + opt[i][0] + '  $' + opt[i][3] + '" onClick="setAttrib(\'' + opt[i][0] + '\')">');
		  }
	  }
    } 
}

function getFlashMovie(movieName) {
 return (navigator.appName.indexOf("Microsoft") != -1) ? window[movieName] : document[movieName];
 }
