
function displayWindow(url, width, height) {
      var url1 = 'bigimage.asp?pic=' + url + '&height=' + height + '&width=' + width;
	  var Win = window.open(url1,"1",'width=' + width + ',height=' + height + ',resizable=1,scrollbars=yes,menubar=no,status=no,screenX=0,screenY=0,top=0,left=0' );
 }
 
function Validationkeyword(theform) {
  if (theform.Keyword.value == "" || theform.Keyword.value == "Search by keyword, manufacturer, or product #") {
      alert("Please enter your search keyword.");
      theform.Keyword.focus();
      return (false);
    }
  
  return (true);
 } 
 
function ValidateSelection(opt){
var f = window.document.frmOptDetail;
var e;
var q;

for(var i=0; i < f.elements.length; i++) {
    e = f.elements[i];
      
    if (e.type == "select-one") {
        if (e.options[e.options.selectedIndex].value =="" && e.name == "p1") {
            if (opt == 1) {
                q = f.elements[i+2];
               } 
            else if (opt == 2) { 
                q = f.elements[i+4];
              }
                
            if (q.name == "qty" && q.value != "" && q.value != "0") {
                alert("Please choose option.");
                e.focus();
                return (false);
             }
        } 
        
        else if (e.options[e.options.selectedIndex].value =="" && e.name == "p2") { 
            q = f.elements[i+2]; 
            if (q.name == "qty" && q.value != "" && q.value != "0") {
                alert("Please choose option.");
                e.focus();
                return (false);
             }
        }
      
      }
   }               
   pageTracker._linkByPost(f);
   return (true);
 } 

function ItemListSelection(theform) { 
  var e;
   
  for(var i=0; i < theform.elements.length; i++) {
      e = theform.elements[i];
      
      if (e.type == "select-one" && e.options[e.options.selectedIndex].value =="") {
          alert("Please choose option.");
          e.focus();
          return (false);
       }
   }     
  pageTracker._linkByPost(theform);
  return (true);
 } 
 
function UpdatePrice(f,p) { 
  var o = f.p1.options[f.p1.options.selectedIndex].text;
  var op = o.split(" --- ");
  var sPrice = op[1];
  
  p.innerHTML = sPrice;
 } 

function switchImage(sColor,sColor1) {
	//var colorpath = 'images/';
	var colorpath = 'image.asp?w=295&image=images/';
	var op = sColor.split(" --- ");
    var color = op[0];
  
	var colorPic = ColorMatrix[color];
	
    if (sColor != "" && sColor1 != "") {
	   if (document.images.ItemPic) {
		   document.images.ItemPic.src = colorpath + colorPic;
	    }
	 } 
 }
 
function switchsize(element,esize) {
    var color = element.options[element.selectedIndex].text;
    var color1 = element.options[element.selectedIndex].value;
    var element1 = document.getElementById(esize);
    var mfr = element;
    var model = element1;
    var ml = ColorList[mfr.options[mfr.selectedIndex].value];
    
    for (var i=model.length; i >= 0; i--){
	     model.options[i] = null;
      }
    
    for (var i=0; i < ml.length; i++){
	     model.options[i] = new Option(ml[i]);
      }
    
    switchImage(color,color1); 
 }

function SetOptions(opt,optname){
var f = window.document.frmOptDetail;
var element;
var color;
var size;
var q;
var price;
var e;
var op;
var itemname;
var itemname1;

for(var i=1; i < opt+1; i++) {
    element = 'color' + i;
    color = document.getElementById(element); 
    
    element = 'size' + i;
    size = document.getElementById(element); 
    
    element = 'qty' + i;
    q = document.getElementById(element); 
    
    if (q.value != "" && q.value != "0") {
        if (color.options[color.options.selectedIndex].value =="") {
            alert("Please choose option.");
            color.focus();
            return (false);
          }
         
        if (size.options[size.options.selectedIndex].text =="" || size.options[size.options.selectedIndex].text == optname) {
            alert("Please choose option.");
            size.focus();
            return (false);
          }
        
        e = color.options[color.options.selectedIndex].text;
        op = e.split(" --- ");
        price = op[1];
          
        element = 'price' + i;
        document.getElementById(element).value = price;  
        
        itemname = f.OptName.value + ' ' + color.options[color.options.selectedIndex].value;
        itemname = itemname + ' ' + f.OptName1.value + ' ' + size.options[size.options.selectedIndex].text;  
        
        element = 'item' + i;
        itemname1 = document.getElementById(element).value + ' ' + itemname;
        document.getElementById(element).value = itemname1;
       }
    } 
    pageTracker._linkByPost(f);
    return (true);
 }   

 function CheckQuick()
{ 
  var f = window.document.frmFront;
  
  var item = f.ItemNo0.value;
  var qty = f.Qty0.value;
  if (qty != "" && !isNaN(qty) && item != "") {
      return (true);
    }
    
  item = f.ItemNo1.value;
  qty = f.Qty1.value;
  if (qty != "" && !isNaN(qty) && item != "") {
      return (true);
    }
  
  item = f.ItemNo2.value;
  qty = f.Qty2.value;
  if (qty != "" && !isNaN(qty) && item != "") {
      return (true);
    }
    
  item = f.ItemNo3.value;
  qty = f.Qty3.value;
  if (qty != "" && !isNaN(qty) && item != "") {
      return (true);
    }
  
  alert("Please enter valid Item Code and Quantity.");        
  return (false);
 } 
