function ColourPicer(ColRef, ScrFileName, ColName, swatchID)
{
var colour_Swatch = document.getElementById(swatchID+"SelectedColour")
var mySCR = "../Colour_pallets/BLACK_archivos/"+ScrFileName
//fill display elements
document.getElementById(swatchID+"txtColCode").value = ColRef
document.getElementById(swatchID+"txtColName").value = ColName
document.getElementById(swatchID+"SelectedColour").style.backgroundImage = "url("+mySCR+")";
//fill the actual hidden fields
document.getElementById(swatchID+"hidEnableQty").value = 1
document.getElementById(swatchID+"txtQant").value = 1
document.getElementById(swatchID+"hid_Ref").value = ColRef
document.getElementById(swatchID+"hid_col_source").value = ScrFileName
document.getElementById(swatchID+"hid_Col_Code").value = ColRef
document.getElementById(swatchID+"hid_Col_Name").value = ColName
}

function ColourPicerGOLD(ColRef, Col_Source, ColName, swatchID)
{
var colour_Swatch = document.getElementById(swatchID+"SelectedColour")
//fill display elements
document.getElementById(swatchID+"txtColCode").value = ColRef
document.getElementById(swatchID+"txtColName").value = ColName
colour_Swatch.style.backgroundColor = Col_Source;
//fill the actual hidden fields
document.getElementById(swatchID+"hidEnableQty").value = 1
document.getElementById(swatchID+"txtQant").value = 1
document.getElementById(swatchID+"hid_col_source").value = Col_Source
document.getElementById(swatchID+"hid_Col_Code").value = ColRef
document.getElementById(swatchID+"hid_Col_Name").value = ColName
}

function ColourPicerPLATinum(ColRef, ScrFileName, ColName, swatchID)
{
var colour_Swatch = document.getElementById(swatchID+"SelectedColour")
var mySCR = "../Colour_pallets/Platinum_archivos/"+ScrFileName
//fill display elements
document.getElementById(swatchID+"txtColCode").value = ColRef
document.getElementById(swatchID+"txtColName").value = ColName
document.getElementById(swatchID+"SelectedColour").style.backgroundImage = "url("+mySCR+")";
//fill the actual hidden fields
document.getElementById(swatchID+"hidEnableQty").value = 1
document.getElementById(swatchID+"txtQant").value = 1
document.getElementById(swatchID+"hid_Ref").value = ColRef
document.getElementById(swatchID+"hid_col_source").value = ScrFileName
document.getElementById(swatchID+"hid_Col_Code").value = "Platinum"
document.getElementById(swatchID+"hid_Col_Name").value = ColName
}


function FormCheck(strCount)
{
if (document.getElementById(strCount+"hid_col_source").value =="xxxx" || document.getElementById(strCount+"hid_Col_Code").value =="xxxx")
    {
    window.alert ("Lo siento, pero no ha seleccionado un color\n\nPor favor seleccione uno.")
	return false;
    }
if (document.getElementById(strCount+"hidSizeoption").value =="1")
	{
if (document.getElementById(strCount+"selSize").value =="0")
    {
    window.alert ("Lo siento, Por favor seleccione un tamaño")
	return false;
    }
	}
if (document.getElementById(strCount+"txtQant").value =="0" ||  document.getElementById(strCount+"txtQant").value =="")
    {
    window.alert ("Lo siento, pero debe introducir un valor en el campo cantidad.")
	return false;
    }
if(isNaN(document.getElementById(strCount+"txtQant").value))
    {
    window.alert ("Lo siento, pero el valor introducido en el campo cantidad no es correcto")
	document.getElementById(strCount+"txtQant").value="";
	return false;
    }
}
function isInteg(obj){
     if(isNaN(obj.value)){
          obj.value = "";
          return false;
     }
     return true;
}

function ModifyQty(Task,ItemID) {
     var QtyField = document.getElementById(ItemID+"txtQant");
     var CurrentQty = +QtyField.value
     var ItemSet = document.getElementById(ItemID+"hidEnableQty").value;
     var ItemLockOn = "Es necesario seleccionar un rango de productos para la paleta antes de usar esta función"
     if (ItemSet != "" && ItemSet != 0) {
          if (Task == "Add") {
               QtyField.value = CurrentQty + 1
          }
            if (Task == "Subtract" && CurrentQty > 0) {
               QtyField.value = CurrentQty - 1
          }
     }
     else alert(ItemLockOn);
     return false;
}
function showPopupWindow(mypage, myname, windowWidth, windowHeight, scroll)
  {
    var centerX = (screen.width - windowWidth) / 2;
    var centerY = (screen.height - windowHeight) / 2;
    mainWindowProperties = 'height='+windowHeight+',width='+windowWidth+',top='+centerY+',left='+centerX
    newPopup = window.open(mypage, myname, mainWindowProperties)
    if (parseInt(navigator.appVersion) >= 4)
      {
        newPopup.window.focus();
      }
}