// JavaScript Document

	ns4 = (document.layers)? true:false
	ie4 = (document.all)? true:false
	if (!ie4) {
		document.captureEvents(Event.MOUSEMOVE);
		var nsX = 0;
		var nsY = 0;
		document.onmousemove = 	function (e) {    nsX = e.pageX; nsY = e.pageY; };
	}
function hideAll()
{ 
document.getElementById('EMAIL-DIV').style.visibility = 'hidden';
}
function showStationaryMenu(menuID)
{
  eval("document.getElementById('"+menuID+"').style.visibility = 'visible';")
}
function showMenu(obj, menuID)
{ 
  var theDiv = document.getElementById(menuID);

  if(document.getElementById || document.all)
    {
       if(obj)
       {  var wid = 0; var widtop = 0; 
         while (obj.offsetParent)
         {
             wid += obj.offsetLeft;
             widtop += obj.offsetTop
             obj = obj.offsetParent;
         }
         wid = wid;
         widtop = widtop;
       }
    }
    else if (document.layers)
   {
       if(obj)
       {  var wid = obj.x;
          var widtop = obj.y;
       }
   }

  wid = wid - 2;
  widtop = widtop + 20;
  wid = wid+"px";
  widtop = widtop+"px";

  theDiv.style.left=wid;
  theDiv.style.visibility='visible';
  theDiv.style.top=widtop;
}

function validateorder(minamount)
{

var amount = document.getElementById('vwquantity').value;
//alert(minamount);
//alert(amount);
//alert(minamount - amount)

   if (Number(amount) < Number(minamount))
   {
     var message = 'The minimum order for this fabric is:  ' + minamount + ' yards';
     alert(message); 
 
   }
   else
   {
     var result=Math.round(amount);
     //alert(result);
     //alert(amount);
     if(result == amount){

             document.form1.submit();    
     //alert('add to cart');
      }
      else{

      var message = 'Fabrics are only available in 1 yard increments';
     alert(message); 

      }
   }
 
}

var isIE = false;
var isclickedcolor = 0;
var isclickedswatch = 0;
if(document.all) isIE=true;

function mzChangeColor(el, cl) { 
    el.value = 'test';
}

function changeColor(varcolor) {
    if(document.getElementById('color1')) {

       if(isclickedcolor > 0)
        {
        document.getElementById('color1').remove(document.getElementById('color1').length -1);
        }
        else
        {
        isclickedcolor =1;
        }
        var y=document.createElement('option');
        y.text=varcolor;
        (isIE)? document.getElementById('color1').add(y) : document.getElementById('color1').add(y,null);
        document.getElementById('color1').options[document.getElementById('color1').length -1].selected = true;
        //mzChangeColor(document.getElementById('color1'), varcolor);

        
    }

    if(document.getElementById('colorswatch')) {

       if(isclickedswatch > 0)
        {
        document.getElementById('colorswatch').remove(document.getElementById('colorswatch').length -1);
        }
        else
        {
        isclickedswatch =1;
        }
        var y=document.createElement('option');
        y.text=varcolor;
        (isIE)? document.getElementById('colorswatch').add(y) : document.getElementById('colorswatch').add(y,null);
        document.getElementById('colorswatch').options[document.getElementById('colorswatch').length -1].selected = true;
   
    }


}

function changeswatchColor(varcolor) {
 
    if(document.getElementById('colorswatch')) {

       if(isclickedswatch > 0)
        {
        document.getElementById('colorswatch').remove(document.getElementById('colorswatch').length -1);
        }
        else
        {
        isclickedswatch =1;
        }
        var y=document.createElement('option');
        y.text=varcolor;
        (isIE)? document.getElementById('colorswatch').add(y) : document.getElementById('colorswatch').add(y,null);
        document.getElementById('colorswatch').options[document.getElementById('colorswatch').length -1].selected = true;
   
    }


}


function changemainColor(varcolor) {
    if(document.getElementById('color1')) {

       if(isclickedcolor > 0)
        {
        document.getElementById('color1').remove(document.getElementById('color1').length -1);
        }
        else
        {
        isclickedcolor =1;
        }
        var y=document.createElement('option');
        y.text=varcolor;
        (isIE)? document.getElementById('color1').add(y) : document.getElementById('color1').add(y,null);
        document.getElementById('color1').options[document.getElementById('color1').length -1].selected = true;
        //mzChangeColor(document.getElementById('color1'), varcolor);

        
    }

}


function showcolors()
{
document.getElementById('divrotate').style.display = 'none';
document.getElementById('divcolors').style.display = 'inline';
}

function showrotate()
{
document.getElementById('divcolors').style.display = 'none';
document.getElementById('divrotate').style.display = 'inline';
}

function showrotatenocolor()
{
document.getElementById('divrotate').style.display = 'inline';
}

function expandImage(imgLoc,imgH,imgW)
  {
imgH = imgH * 1; imgW = imgW * 1;
var X = window.screen.availHeight;
var Y = window.screen.availWidth;
X = X - 100;  Y = Y - 50;
if(X > (imgH + 90)) 
{ X = (imgH + 90); }
if(Y > (imgW + 40)) 
{ Y = (imgW + 40); }
if(Y<210){  Y = 210;    }
  var popWin = window.open('','','toolbar=0, location=0,status=0,menubar=0,resizable=0,scrollbars=1,width='+Y+',height=' + X);
  popWin.document.open();
  popWin.document.write('<ht'+'ml><he'+'ad><ti'+'tle>NY Fashions</tit'+'le><script language=javascript> var message="This function is Disabled"; function click(z) { if (document.all) { if (event.button == 2) { alert(message); return false; } } if (document.layers) { if (z.which == 3) { alert(message); return false;}}} if (document.layers) { document.captureEvents(Event.MOUSEDOWN); } document.onmousedown=click; </script></he'+'ad><bo'+'dy>');
  popWin.document.write('<img alt="loading expanded image... please wait..." name=mainImage src='+imgLoc+' border=0>');
  popWin.document.write('<br><br><font face=verdana,arial,helvetica size=2><b><center><a href="javascript:window.close()"><b><font color=15325A>Close Window</a>');
  popWin.document.write('</body></html>');
  popWin.document.close();
  popWin.moveTo(50,50);
  }

  function emailPage()
  {
      eval("window.open('http://69.20.61.233/tools/email-a-friend/?storename=yhst-80031435670875&theURL="+window.location+"','email_popup','menubar=no,scrollbars=no,width=500,height=420')");  
  }
var ie6=0;

