function DisplayColor(Color, SwatchID)
{
	var swatchlabel = document.getElementById(SwatchID);
	swatchlabel.innerHTML= Color;
}

function DefaultColor(DefaultColor, SwatchID)
{
	var swatchlabel = document.getElementById(SwatchID);
	swatchlabel.innerHTML= DefaultColor;
}

function OpenPopUp(URL, Name, Params, FormName)
{
    var browserType = navigator.userAgent.toLowerCase();
	var PopUpWin = null;
	var varFormName=null;
	var varChildWindow=null;
	if (PopUpWin && (navigator.appName == "Microsoft Internet Explorer"))
	{
		PopUpWin.close();
	}
	if (URL.indexOf("PopUpBlocked=true") > 0);
	{
	    URL = URL.replace("&PopUpBlocked=true","");
	    URL = URL.replace("?PopUpBlocked=true","");
	}
	//open the window
    if (browserType.indexOf("opera") < 0) //not opera
	{
	    PopUpWin=window.open(URL, Name, Params);
	    if (PopUpWin)
	    {
	        // popup successfully created
	        // set window as the focus
		    PopUpWin.focus();
	    }
	    else 
	    {
	        if (URL.indexOf("zoom") < 0) //not pan&zoom
	        {
                URL += '&PopUpBlocked=true'
                location.href = URL
	        }
	    }
    }
	else //opera kills the code if open window attempted - must redirect automatically
	{
        if (strUrl.indexOf('zoom') < 0) //not pan&zoom
        {
            strUrl = strUrl + '&PopUpBlocked=True'
            location.href = strUrl
        }
	}
	varChildWindow = PopUpWin;
    if (FormName != null || '')
    {
	    varFormName = FormName;
	    return true;
	}
}

function closeChildWindow()
{
    if (varChildWindow != null)
    {
        if (varChildWindow.closed == false)
        {
            varChildWindow.close();
        }
    }
}

function closeWin()
{
	window.close();
}








function toggleImgColor(currentTD, tableName)
{
	var tdTag = document.getElementById(tableName).getElementsByTagName('td');
	for (var counter = 0; counter < tdTag.length; counter++) 
	{ 
		var imgTag= tdTag[counter].getElementsByTagName('img');
		if (imgTag != null)
		{			
			var imgClass = imgTag.item(0).className;
			if (imgClass == 'ImageViewClass')
			{
				imgTag.item(0).className = '';
			}
		}
	}
	currentTD.className = 'ImageViewClass';
	
}

function SwapLargeColorsImage(strSwatchImagePath)
{
	document.LargeProductColor.src= strSwatchImagePath;
}


function SwapImageProduct(Scene7Server, strRGBColor, strObjName, strVignetteName, SwatchText, ZoomServer)
{
	varImgSrc = Scene7Server + strVignetteName + '?wid=250&hei=250&obj=' + strObjName + '&color='
	var index = strRGBColor.indexOf(",");
	var afterSwap = 'swapView'
	
	if (index != -1)
	{
		document.ProductImage.src= varImgSrc + strRGBColor;
	}
	else
	{
		document.ProductImage.src = ZoomServer + 'is/image/' + strRGBColor + '?wid=250&hei=250&op_sharpen=1';
	}
	document.getElementById('spanid').innerHTML = SwatchText;
	 
}



function validate_email(field,alerttxt)
{
with (field)
{
apos=value.indexOf("@")
dotpos=value.lastIndexOf(".")
if (apos<1||dotpos-apos<2) 
  {alert(alerttxt);return false}
else {return true}
}
}

function validate_form(thisform)
{
with (thisform)
{
if (validate_email(email,"Not a valid e-mail address!")==false)
  {email.focus();return false}
}
}



			function popUp(URL) {
			day = new Date();
			id = day.getTime();
			eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=1,width=330,height=300,left = 475,top = 362');");
			}