
var browser=navigator.appName;
var b_version=navigator.appVersion;
var version=parseFloat(b_version);

var winColorImage = null

var AllColourSwatch=new Array()
AllColourSwatch[00] = ""

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 chkNumericKeyPress(e) {

	// character allowed to input '0123456789.' no space character
	var charCode = (navigator.appName == "Netscape") ? e.which : e.keyCode;
	var status = charCode;
		
	if (charCode > 31 && (charCode < 48 || charCode > 57) &&
	   (charCode != 46))
		return false;
	else
		return true;		
}

function chkDateKeyPress(e) {

	// character allowed to input '0123456789/-' no space character
	var charCode = (navigator.appName == "Netscape") ? e.which : e.keyCode;
	var status = charCode;
		
	if (charCode > 31 && (charCode < 48 || charCode > 57) &&
	   (charCode != 47) && (charCode != 45)) 
		return false;
	else
		return true;		
}

function chkTimeKeyPress(e) {

	// character allowed to input '0123456789:' no space character
	var charCode = (navigator.appName == "Netscape") ? e.which : e.keyCode;
	var status = charCode;
	
	//alert(charCode)
		
	if (charCode > 31 && (charCode < 48 || charCode > 57) &&
	   (charCode != 58))	
		return false;
	else
		return true;		
}

function chkPhoneKeyPress(e) {

	// character allowed to input '0123456789()-,' including space character
	var charCode = (navigator.appName == "Netscape") ? e.which : e.keyCode;
	var status = charCode;
		
	if (charCode > 31 && (charCode < 48 || charCode > 57) &&
	   (charCode != 40 && charCode != 41 && charCode != 45 && charCode != 44 && charCode != 32))	
		return false;
	else
		return true;		
}

//function ViewPattern(imgPath,ImgWidth,ImgHeight) {
function ViewPattern(imgPath) {	
	
	//alert('ViewPattern')

	var FullWidth = screen.availWidth
	var Center_x = (FullWidth - winWidth) / 2

	var FullHeight = screen.availHeight
	var Center_y = (FullHeight - winHeight) / 2

	var ImgWidth = 540
	var ImgHeight = FullHeight

	var winWidth = ImgWidth;
	var winHeight = 600;//ImgHeight;

    if (!winColorImage || winColorImage.closed) { 
		winColorImage = window.open("ColourSwatches.php","ColourSwatches","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=" + winWidth + ",height=" + winHeight + ",left=" + Center_x + ",top=" + Center_y );
        if (!winColorImage.opener){
			winColorImage.opener = window
		}
	} else {
		winColorImage.location = "ColourSwatches.php?XXX=123"
		winColorImage.focus();
	}
	
/*		
		var newContent = "<Html><Head><Title>Fibre Red</Title></Head>\n"
		newContent +=  "<body bgcolor='#7c1530' text='#000000' leftmargin='0' topmargin='0' marginwidth='0' marginheight='0'>\n"
		newContent +=  "<table border='0' cellspacing='0' cellpadding='0' height='" + winHeight + "' width='" + winWidth + "'>\n"
  		newContent +=  "<tr>\n"
      		//newContent +=  "<td align='center' valign='middle'><img src='images/" + document.all.ImgName.value + "' border='0' width='" + ImgWidth + "' height='" + ImgHeight + "'></td>\n"
      		newContent +=  "<td align='center' valign='middle'><img src='images/ColorImg/" + imgPath + "' border='0'></td>\n"			
  		newContent +=  "</tr>\n"
		newContent +=  "</table>\n"
		newContent +=  "</Body></Html>"
 		winColorImage.document.write(newContent) 
 		winColorImage.document.close()
    } else {
	    winColorImage.close();
		ViewPattern(imgPath,ImgWidth,ImgHeight);
//		winColorImage.focus();
    }
*/
}

function popOrderForm(){

	var iProductName =Thisfrm.ProductName.value 
	var iProductCode =Thisfrm.ProductCode.value 
	var iSize  = "" //Thisfrm.Size.value 
	var iColor = "" //Thisfrm.ColourSwatches.value 
	var iPrice = "" //Thisfrm.UnitPrice.value  

	window.open('frmOrder.htm?ProductName='+iProductName+'&ProductCode='+iProductCode+'&Colour='+iColor+'&Size='+iSize+'&UnitPrice='+iPrice,'_blank','toolbar=yes,titlebar=no,width=880,height=600,top=0,left=0,z-lock=1,resizable=1,scrollbars=yes');	

}

function popEnquiryForm(){

	var iProductName = Thisfrm.ProductName.value 
	var iProductCode = Thisfrm.ProductCode.value 
	var iSize  = "" //Thisfrm.Size.value 
	var iColor = "" //Thisfrm.ColourSwatches.value 

	window.open('frmEnquiry.php?ProductName='+iProductName+'&ProductCode='+iProductCode+'&Colour='+iColor+'&Size='+iSize,'_blank','titlebar=no,width=520,height=600,top=0,left=0,z-lock=1,resizable=0');	

}

function popHowToOrder(){

	var iProductName = Thisfrm.ProductName.value 
	var iProductCode = Thisfrm.ProductCode.value 
	var iSize  = "" //Thisfrm.Size.value 
	var iColor = "" //Thisfrm.ColourSwatches.value 

	window.open('frmHowToOrder.php?ProductName='+iProductName+'&ProductCode='+iProductCode+'&Colour='+iColor+'&Size='+iSize,'_blank','titlebar=yes,width=520,height=420,top=0,left=0,z-lock=1,resizable=0');	

}

function fitPic(imgPath,imgName){

	//imgPath="<% =ColorPatternPath %>"
	//imgName=Thisfrm.ColorFullSize.value 
	imgColor=Thisfrm.ColourSwatches.value 
	
	window.open('popImageWindow.html?'+imgPath+'?'+imgName+'?'+imgColor,'_blank','titlebar=no,width=400,height=250,top=0,left=0,z-lock=1,resizable=0');
}

function popColorView(imgPath,imgName){
	//var imgPath = "images/ColorImg/"
	var imgColor=Thisfrm.ColourSwatches1.value 
	
	window.open('frmColorPatternView.php?imgPath='+imgPath+'&imgName='+imgName+'&imgColor='+imgColor,'_blank','titlebar=no,width=400,height=250,top=0,left=0,z-lock=1,resizable=0');	
}

function SwapItem(whichImg){

	//alert(document.getElementById('ItemImg'+whichImg).src.substr(document.getElementById('ItemImg'+whichImg).src.length-10,10))
	CurrentImgName = document.getElementById('ItemImg'+whichImg).src.substr(document.getElementById('ItemImg'+whichImg).src.length-10,10)

	if (CurrentImgName != "spacer.gif"){
	
		TmpImg1 = CurrItemImg1
		CurrItemImg1 = eval("CurrItemImg"+whichImg)
		
		eval("CurrItemImg"+whichImg+"=TmpImg1")
/*		
		if (whichImg==2) CurrItemImg2 = TmpImg1
		if (whichImg==3) CurrItemImg3 = TmpImg1
		if (whichImg==4) CurrItemImg4 = TmpImg1
*/
		
		MainImgPath = ImgPath[CurrItemImg1].split(",")[0]
		objImgMain = eval("document.getElementById('ItemImg1')");
		objImgMain.src = "images/ItemsImg/" + MainImgPath

		SubImgPath = ImgPath[eval("CurrItemImg"+whichImg)].split(",")[1]
		objImgSub = eval("document.getElementById('ItemImg"+whichImg+"')");
		objImgSub.src = "images/ItemsImg/" + SubImgPath
	}
	
	//alert(CurrItemImg1 + '-' + CurrItemImg2 + '-' + CurrItemImg3)

}

/*
function defaultImgSet(){

	//alert(window.location.href.split("?")[1])
	//alert(window.location.href.indexOf("?"))
	
	if (window.location.href.indexOf("?")>-1) {
	
		postParamStr = window.location.href.split("?")[1]
		postParamVal = postParamStr.split("&")
	
//		alert(postParamVal.length)
	
		for (var m = 0; m <= postParamVal.length-1; m++) {
			eval('CurrItemImg' + (m + 1) + ' = postParamVal[' + m + '].split("=")[1]')
		}
		
//		CurrItemImg1 = postParamVal[0].split("=")[1]
//		CurrItemImg2 = postParamVal[1].split("=")[1]
//		CurrItemImg3 = postParamVal[2].split("=")[1]


	} else {

//		alert(ImgPath.length)

		for (var m = 1; m <= ImgPath.length-1; m++) {
			eval('CurrItemImg' + m + ' = ' + m)
		}

//		CurrItemImg1 = 1
//		CurrItemImg2 = 2
//		CurrItemImg3 = 3
//		
	}

	placeImg()

}
*/


function defaultImgSet(){

	for (var m = 1; m <= ImgPath.length-1; m++) {
		eval('CurrItemImg' + m + ' = ' + m)
	}
	placeImg()

}

function placeImg(){

/*
	document.getElementById('ItemImg1').src = "images/ItemsImg/" + ImgPath[CurrItemImg1].split(",")[0]
	if (document.getElementById('ItemImg2') && ImgPath[CurrItemImg2].split(",")[1] != "-") document.getElementById('ItemImg2').src = "images/ItemsImg/" + ImgPath[CurrItemImg2].split(",")[1]
	if (document.getElementById('ItemImg3') && ImgPath[CurrItemImg3].split(",")[1] != "-") document.getElementById('ItemImg3').src = "images/ItemsImg/" + ImgPath[CurrItemImg3].split(",")[1]
*/

	document.getElementById('ItemImg1').src = "images/ItemsImg/" + ImgPath[CurrItemImg1].split(",")[0]
	for (var m = 2; m <= ImgPath.length-1; m++) {
		if (document.getElementById('ItemImg'+m) && ImgPath[eval("CurrItemImg"+m)].split(",")[1] != "-") {
			document.getElementById('ItemImg'+m).src = "images/ItemsImg/" + ImgPath[eval("CurrItemImg"+m)].split(",")[1]
		}	
	}	

}

function ResetDropDownBox(ObjName){

	//alert('ResetDropDownBox(' + O bjName + ')')
	
	//objDropDownBox = eval("Thisfrm." + ObjName + "List")
	objDropDownBox = eval("Thisfrm." + document.getElementById(ObjName).name)


	OrgObjLength = objDropDownBox.length
	for (var i = 0; i <= OrgObjLength; i++) {
		objDropDownBox.remove(0) //removes last option within SELECT
	}

	//objDropDownBox.add(new Option("Select " + ObjName, -1))
	//new Option('text', 'value', true, true);
	
	var anOption = document.createElement("OPTION");
	//alert(getElementById(ObjName + "List"))
	document.getElementById(ObjName).options.add(anOption);
	anOption.text = "Select " + ObjName;
	anOption.value = "-1";	
	
}

function PresetDropDownBox(ObjArray, ObjName){

	//alert('PresetDropDownBox(' + ObjName + ')')
	ResetDropDownBox(ObjName)
	
	objDropDownBox = eval("Thisfrm." + ObjName + "List")

	if (ObjName=="Size"){
		//alert(ItemSize.length)
 		for (var j = 1; j <= ItemSize.length-1; j++) {
			//objDropDownBox.add(new Option(ItemSize[j], ItemSize[j]))
			//alert(ItemSize[j])
			var anOption = document.createElement("OPTION");
			document.getElementById(ObjName).options.add(anOption);
			anOption.text = ItemSize[j];
			anOption.value = ItemSize[j];
		}
	} else {
	//if (ObjName=="Colour"){
		//alert(ObjArray.length)
 		for (var i = 1; i <= ObjArray.length-1; i++) {
			//objDropDownBox.add(new Option(ObjArray[i].replace("&nbsp;",""), ObjArray[i].replace("&nbsp;","")))
			//alert(ObjArray[i])
			var anOption = document.createElement("OPTION");
			document.getElementById(ObjName).options.add(anOption);
			anOption.text = ObjArray[i].replace("&nbsp;","");
			anOption.value = ObjArray[i].replace("&nbsp;","");
		}
	}	
	
}

function changeOptArea(ViewMode){
	
	Thisfrm.ColorViewMode.value=ViewMode
	document.getElementById("SelectWhichAreaLabel").innerHTML=document.getElementById("ColourList"+ViewMode).options[0].text

}	

function changeColorOpt(OptValue,AreaID){

	//alert(OptValue)

	SwatchesType = OptValue.split(" - ")[0]
	OptColor = OptValue.split(" - ")[1]

	document.getElementById("SwatchesType"+AreaID).value = SwatchesType
	document.getElementById("ColourSwatches"+AreaID).value = OptColor
	
}	

function changeOptValue(SwatchesType,OptColor){

	Thisfrm.SwatchesType1.value = SwatchesType
	Thisfrm.ColourSwatches1.value = OptColor
	//if (Thisfrm.ColourList1) Thisfrm.ColourList1.value = SwatchesType + " - " + OptColor
	//if (document.getElementById("ColorViewMode").value !="0" ){
	//		document.getElementById("ColourList"+(document.getElementById("ColorViewMode").value)).value = SwatchesType + " - " + OptColor
	//	}
	
}	

function InitItemDetail(){

	document.getElementById("ProductName").innerHTML = ProductName.toUpperCase()

/*
	tmpSizeArray = "";
	for (var j = 1; j <= ItemSize.length-1; j++) {
		tmpSizeArray = tmpSizeArray + ItemSize[j] + ', '
	}
	
	document.getElementById("SizeAvailable").innerHTML = tmpSizeArray.substr(0,tmpSizeArray.length-2)
	
	if (Thisfrm.OrderType.value=="WholeSell"){
		document.getElementById("LabelUnitPrice").innerHTML = "Wholesale "	
	} else {
		document.getElementById("LabelUnitPrice").innerHTML = ""	
	}
	
	document.getElementById("txtUnitPrice").innerHTML = UnitPrice
	Thisfrm.UnitPrice.value = UnitPrice
	
	Thisfrm.ProductName.value = ProductName.toUpperCase()
	Thisfrm.ProductCode.value = ProductCode
*/
}

function VerifyCheckoutData(){

	//alert('in VerifyItemData')

	var FieldList = "Requirer|Telephone|Email|Street|Suburb|State|Postcode|Country";
	CurrentObjName = FieldList.split("|")
	frmChecked = false;
	
	for (var i = 0; i < CurrentObjName.length; i++) {
		ObjName = eval("Thisfrm."+ CurrentObjName[i])
		if (ObjName.value == "" || ObjName.value <= 0) {
			alert("Please input " + ObjName.id + " before submit");
			frmChecked = false;
			ObjName.focus();
			break;
		} else {
			frmChecked = true;
		}
	}
	
	//alert(frmChecked)
	//return frmChecked;
	if (frmChecked) ThisFrmAction('CheckOutCart')

}

function VerifyItemData(){

	//alert('in VerifyItemData')

	var BaseFieldList = "SizeList|ColourList1";

	if (document.getElementById("ColourList2")){
		//alert(document.getElementById("ColourList2").value)
		BaseFieldList = BaseFieldList + "|ColourList2";
	}	

/*
	if (document.getElementById("Variations")){
		//alert(Thisfrm.Variations.length)
		BaseFieldList = BaseFieldList + "|Variations";
	}	
*/

	BaseFieldList = BaseFieldList + "|Qty";

	var FieldList = BaseFieldList;
	CurrentObjName = FieldList.split("|")
	frmChecked = false;
	
	for (var i = 0; i < CurrentObjName.length; i++) {
		ObjName = eval("Thisfrm."+ CurrentObjName[i])
		if (ObjName.value == "" || ObjName.value <= 0) {
			alert("Please input " + ObjName.id + " before submit");
			frmChecked = false;
			ObjName.focus();
			break;
		} else {
			frmChecked = true;
		}
	}
	
	//alert(frmChecked)
	//return frmChecked;
	if (frmChecked) ThisFrmAction('AddItemToCart')

}

function ThisFrmAction(vAction){
	
	URLLevel = 2 			/* http:// or https:// has 2 "/" */
	SubFolderLevel = 3 
	
	Thisfrm.ModuleMode.value = vAction;
	xName = window.location.href.split("/")
	if (document.getElementsByName("LastVisitPage")[0]) {
		//alert(xName.length);
		//alert(xName[xName.length-1])
		Thisfrm.LastVisitPage.value = xName[xName.length-1]		
/*
		if (xName.length == URLLevel+SubFolderLevel){
			Thisfrm.LastVisitPage.value = xName[xName.length-1]
		} else {	
			Thisfrm.LastVisitPage.value = xName[xName.length-2] + "/" + xName[xName.length-1]
		}
*/		
	}
	//VerifyItemData();
	Thisfrm.submit();
	
}

function leadingZero(n){
  // pads a single number with a leading zero. Heh.
  if (n.length==1) n = "0" + n;
  return n;
}

function combineColorArray(ColorArray){

	//alert(AllColourSwatch.length)
	//alert(ColorArray.length)
	//tmpArray = ColorArray.join(",")
	
	OrgLength = AllColourSwatch.length

	ColorArrayCnt=1	
	for (var i = AllColourSwatch.length; i < OrgLength+ColorArray.length-1; i++) {
		//alert(ColorArray[ColorArrayCnt]);
		AllColourSwatch[i] = ColorArray[00] + " - " + ColorArray[ColorArrayCnt]
		ColorArrayCnt=ColorArrayCnt+1
	}
	//alert(AllColourSwatch.join(","));
}

function confirmWholeSellerLogout(){

	var message = "Are you sure you want to Logout?";
	var return_value = confirm(message);
	if (return_value){
		window.location = "frmWholeSellerLogin.php";
	}

}

function ResetDropDownBoxNew(ObjName){

	//alert('ResetDropDownBox(' + O bjName + ')')
	
	//objDropDownBox = eval("Thisfrm." + ObjName + "List")
	objDropDownBox = eval("Thisfrm." + document.getElementById(ObjName).name)


	OrgObjLength = objDropDownBox.length
	for (var i = 0; i <= OrgObjLength; i++) {
		objDropDownBox.remove(0) //removes last option within SELECT
	}

	//objDropDownBox.add(new Option("Select " + ObjName, -1))
	//new Option('text', 'value', true, true);
	
	var anOption = document.createElement("OPTION");
	//alert(getElementById(ObjName + "List"))
	document.getElementById(ObjName).options.add(anOption);
	anOption.text = "Select " + ObjName;
	anOption.value = "-1";	
	
}

function PresetDropDownBoxNew(ObjArray, ObjName){

	//alert('PresetDropDownBox(' + ObjName + ')')
	ResetDropDownBoxNew(ObjName)
	
	objDropDownBox = eval("Thisfrm." + ObjName + "List")

	if (ObjName=="Size"){
		//alert(ItemSize.length)
 		for (var j = 1; j <= ItemSize.length-1; j++) {
			//objDropDownBox.add(new Option(ItemSize[j], ItemSize[j]))
			//alert(ItemSize[j])
			var anOption = document.createElement("OPTION");
			document.getElementById(ObjName).options.add(anOption);
			anOption.text = ItemSize[j];
			anOption.value = ItemSize[j];
		}
	} else {
	//if (ObjName=="Colour"){
		//alert(ObjArray.length)
 		for (var i = 1; i <= ObjArray.length-1; i++) {
			//objDropDownBox.add(new Option(ObjArray[i].replace("&nbsp;",""), ObjArray[i].replace("&nbsp;","")))
			//alert(ObjArray[i])
			var anOption = document.createElement("OPTION");
			document.getElementById(ObjName).options.add(anOption);
			anOption.text = ObjArray[i].replace("&nbsp;","");
			anOption.value = ObjArray[i].replace("&nbsp;","");
		}
	}	
	
}

function ResetDropDownBoxAdvance(ObjName,DefaullLabel,MenuWidth){

	//alert('ResetDropDownBox(' + O bjName + ')')
	
	//objDropDownBox = eval("Thisfrm." + ObjName + "List")
	objDropDownBox = document.getElementById(ObjName)

	OrgObjLength = objDropDownBox.length

	for (var i = 0; i <= OrgObjLength; i++) {
		objDropDownBox.remove(0) //removes last option within SELECT
	}

	if (MenuWidth!=0){
		if (DefaullLabel!="") DefaullLabel = DefaullLabel + ' '
	
		tmpX = ""
		for (var j = 1; j <= MenuWidth - DefaullLabel.length ; j++) {
			tmpX = tmpX + "-"
		}
	
		var anOption = document.createElement("OPTION");
		document.getElementById(ObjName).options.add(anOption);
		
		anOption.text = DefaullLabel + tmpX;
		anOption.value = "-1";	
	}	
}

function PresetSize(arryName,ObjName,DefaullLabel,MenuWidth){

	ResetDropDownBoxAdvance(ObjName,DefaullLabel,MenuWidth)
	objDropDownBox = document.getElementById(ObjName)

	if (arryName=='SizeRangeA') arryName = SizeRangeA
	if (arryName=='SizeRangeB') arryName = SizeRangeB

	//if (arryName.length > 2){
		var anOption = document.createElement("OPTION");
		objDropDownBox.options.add(anOption);
		anOption.text = "Select" + DefaullLabel + " Size"
		anOption.value = "-1"
	//}	

	for (var j = 1; j <= arryName.length-1; j++) {
		//objDropDownBox.add(new Option(ItemSize[j], ItemSize[j]))
		//alert(ItemSize[j])
		var anOption = document.createElement("OPTION");
		document.getElementById(ObjName).options.add(anOption);
		anOption.text = arryName[j];
		anOption.value = arryName[j];
	}
}

function PresetColor(arryName,ObjName,DefaullLabel,MenuWidth){

	if (browser=='Netscape') myClass='class';
	if (browser=='Microsoft Internet Explorer') myClass='className';

	noAlert = false

	var ProductColourSwatch=new Array()
	ProductColourSwatch[00] = ""

	ResetDropDownBoxAdvance(ObjName,DefaullLabel,MenuWidth)
	objDropDownBox = document.getElementById(ObjName)

	ColorSpec = arryName.split('|')

	for (i=0; i<= ColorSpec.length-1; i++ ){

		if (ColorSpec[i]=='SolidMerinoWoolColour') {
			SwatchesViewID = 3;
			ColorArray = SolidMerinoWoolColour
		}
		
		if (ColorSpec[i]=='MixedMerinoWoolColour') {
			SwatchesViewID = 4;
			ColorArray = MixedMerinoWoolColour
		}	
		
		if (ColorSpec[i]=='OrganicCottonColour') {
			SwatchesViewID = 5;
			ColorArray = OrganicCottonColour
		}	

		if (ColorSpec[i]=='MohairColour') {
			SwatchesViewID = 6;
			ColorArray = MohairColour
		}	


		if (ColorSpec[i]=='PantsButtonColour') {
			SwatchesViewID = 7;
			ColorArray = PantsButtonColour
		}	


		if (ColorSpec[i]=='WLP1MainColour') {
			SwatchesViewID = 8;
			ColorArray = WLP1MainColour
		}	
		
		if (ColorSpec[i]=='WLP2MainColour') {
			SwatchesViewID = 9;
			ColorArray = WLP2MainColour
		}			

		if (ColorSpec[i]=='OtherOptionColor') {
			SwatchesViewID = 10;
			ColorArray = OtherOptionColor
		}		

		if (ColorSpec[i]=='BroochColour') {
			SwatchesViewID = 3;
			if (document.getElementById("hdn"+SwatchesViewID)){
				if (document.getElementById("hdn"+SwatchesViewID).style.display=='none') show_hide(SwatchesViewID);
			}
			SwatchesViewID = 4;
			if (document.getElementById("hdn"+SwatchesViewID)){
				if (document.getElementById("hdn"+SwatchesViewID).style.display=='none') show_hide(SwatchesViewID);
			}			
			ColorArray = BroochColour
		}	

		if (document.getElementById("hdn"+SwatchesViewID)){
			if (document.getElementById("hdn"+SwatchesViewID).style.display=='none') show_hide(SwatchesViewID);
		}
		
		OrgLength = objDropDownBox.length

		if (OrgLength==0){
			var anOption = document.createElement("OPTION");
			objDropDownBox.options.add(anOption);
			anOption.text = "Select" + DefaullLabel + " Colour";
			anOption.value = "-1";
		}	

		var anOptionGroup = document.createElement('OPTGROUP');
		//anOptionGroup.className="inputTxt";
		anOptionGroup.setAttribute(myClass, 'OptGrp');	
		anOptionGroup.label = "" + ColorArray[00] + "";
		objDropDownBox.appendChild(anOptionGroup);

		for (var j = 1; j <= ColorArray.length-1; j++) {
			var anOption = document.createElement("OPTION");
			objDropDownBox.options.add(anOption);
			anOptionGroup.appendChild(anOption);
			anOption.setAttribute(myClass, 'inputTxt');
			anOption.text = ColorArray[j].replace("&nbsp;","");
			//anOption.text = ColorArray[00] + " - " + ColorArray[j].replace("&nbsp;","");
			anOption.value =  ColorArray[00] + " - " + ColorArray[j].replace("&nbsp;","");
			
		}

	}
	
}

function PresetVariation(arryName,ObjName,DefaullLabel,MenuWidth){

	ResetDropDownBoxAdvance(ObjName,DefaullLabel,MenuWidth)
	objDropDownBox = document.getElementById(ObjName)

	if (arryName=='VariationA'){

		OrgObjLength = objDropDownBox.length
		for (var i = 0; i <= OrgObjLength; i++) {
			objDropDownBox.remove(0) //removes last option within SELECT
		}
		
		if (DefaullLabel!="") DefaullLabel = DefaullLabel + ' '
	
		var anOption = document.createElement("OPTION");
		document.getElementById(ObjName).options.add(anOption);
		
		anOption.text = "Standard ----------------------------";
		anOption.value = "Standard";	
		
	} else {	
		
		if (arryName=='VariationB') arryName = VariationB
		if (arryName=='VariationC') arryName = VariationC
		if (arryName=='VariationD') arryName = VariationD
		if (arryName=='VariationE') arryName = VariationE

		for (var j = 1; j <= arryName.length-1; j++) {
			var anOption = document.createElement("OPTION");
			document.getElementById(ObjName).options.add(anOption);
			anOption.text = arryName[j];
			anOption.value = arryName[j];
		}
	
	}	
}

function AreaShowHide(ViewMode){

	if (ViewMode==0){

		show_hide(0);
		show_hide(1);
		show_hide(2);
	
	} else {

		if (document.getElementById("hdn0").style.display=='block'){
			show_hide(0);
			show_hide(1);
			show_hide(2);	
		}	
	
	}

}

function GetRadioValue(objName){

	RadioGrpName = document.getElementsByName(objName)
	NoOfRadioOpt = RadioGrpName.length
	//alert(NoOfRadioOpt)
	
	RadioValue = -1 // No Radio selected
	for (var i = 0; i <= NoOfRadioOpt-1; i++) {
		if (RadioGrpName[i].checked){
			RadioValue = RadioGrpName[i].value
			break
		}
	}
	
	//alert(RadioValue)
	return RadioValue
	
}

function removeUnuseItemOpt(ItemOptID){

		var tbl = document.getElementById("tblItemOpt");
		for (var i=0; i<tbl.tBodies[0].rows.length; i++) {
			//if (tbl.tBodies[0].rows[i].id != "") alert(tbl.tBodies[0].rows[i].id);
			if (tbl.tBodies[0].rows[i].id == ItemOptID) tbl.deleteRow(i);
		}

}

