// JScript File

  function ShowDetailWindow(args){
    var Width = (args.width)? args.width : 0;
    var Height = (args.height)? args.height : 0;
    var CategoryID = (args.CategoryID)? args.CategoryID : 0;
    var ProductID = (args.ProductID)? args.ProductID : 0;
    var URL = (args.URL)? args.URL : "";
    var Title = (args.title)? args.title : "Detail View";
    var OverlayClose = (args.OverlayClose)? args.OverlayClose : true;
    var OverlayOpacity = (args.OverlayOpacity)? args.OverlayOpacity : .5;
    
    if (args.URL){
    var URL = args.URL.toLowerCase();
      if (URL.lastIndexOf(".jpg") + 4 == URL.length && !(URL.lastIndexOf(".aspx") > -1)){
        ShowLargerImage(URL, OverlayOpacity);
        return;
      }
    }
    
    /*Create a new inline frame object if not passed one in parameters*/
    var newIframe = (args.iFrame)? $(args.iFrame) : document.createElement("iframe");
    if (!newIframe.id) newIframe.id = "DetailWindow";  
	  newIframe.style.display = 'block';	
    if (args.CategoryID && args.ProductID) {
 	      newIframe.src = "HardwareDetail.aspx?CID="+Cat+"&PID="+Value;
        DivBox.show(newIframe, {title: Title, width:Width, height:Height, overlayOpacity: OverlayOpacity, overlayClose: OverlayClose});
        return true;
    }
    if (args.URL){
 	    newIframe.src = args.URL;
      DivBox.show(newIframe, {title: Title, width:Width, height:Height, overlayOpacity: OverlayOpacity, overlayClose: OverlayClose});
    }
  }
  
  function ShowDetail(Cat,Value){
    if (Value.length > 6) {
      ShowDetailWindow({width: 380, height: 410, URL: Value});
    }else{ 
      if (Value > 0) {
        ShowDetailWindow({title: 'Hardware Detail', width: 400, height: 400, URL: "HardwareDetail.aspx?CID="+Cat+"&PID="+Value});
      }
    }
    
  }
  function ShowLargerImage(url, OverlayOpacity){
 	  var imgPreloader = new Image();
	
    // if loader image found, create link to hide lightbox and create loadingimage
    imgPreloader.onload=function(){
    
	    var ImageTag = document.createElement("img");
	    ImageTag.src = url;
	    ImageTag.setAttribute('id','DetailImage');
	    ImageTag.style.display = 'none';
      ImageTag.width = imgPreloader.width;
      ImageTag.height = imgPreloader.height;
	    imgPreloader.onload=function(){};	//	clear onLoad, as IE will flip out w/animated gifs
      
      DivBox.show(ImageTag, {title: 'Detail Image', width: imgPreloader.width, height: imgPreloader.height, overlayOpacity: OverlayOpacity, overlayClose:true});

	    return false;
    }

    imgPreloader.src = url;
   
  }


  function OpenPBHelp() {
      var left, top;
      left = (window.screen.availWidth - 600) / 2;
      top = (window.screen.availHeight - 400) / 2;
      window.open("ProductBuilderHelp.htm", "PBHelp", "height=400,width=600,top=" + top + ",left=" + left + ",status=no,toolbar=no,menubar=no,location=no,resizable=yes,scrollbars=yes,status=no");
  }
  
  function OpenHelp(HelpUrl) {
      var left, top;
      left = (window.screen.availWidth - 600) / 2;
      top = (window.screen.availHeight - 400) / 2;
      window.open(HelpUrl, "PBHelp", "height=400,width=600,top=" + top + ",left=" + left + ",status=no,toolbar=no,menubar=no,location=no,resizable=yes,scrollbars=yes,status=no");
  }
  
  function OpenPBDetail(CatID, NodeID){
		var left,top;
		left = (window.screen.availWidth - 700) / 2; 
		top = (window.screen.availHeight - 550) / 2;
		if ((CatID > 0) && (NodeID > 0)) {
		    window.open("Wizard_Detail.aspx?CID=" + CatID + "&PID=" + NodeID, "PBHelp", "height=550,width=700,top=" + top + ",left=" + left + ",status=no,toolbar=no,menubar=no,location=no,resizable=no,scrollbars=yes,status=no");
		}
	}
  function OpenPBLarge(name){
		var left,top;
		left = 0; 
		top = 0 ;
		window.open(name,"PBLarge","height=550,width=700,top="+top+",left="+left+",status=no,toolbar=no,menubar=no,location=no,resizable=yes,scrollbars=yes,status=no");
	}

	function OpenPBDetailg(CatID, NodeID) {
		var left,top;
		left = (window.screen.availWidth - 600);
		top=(window.screen.availHeight -400);
		if ((CatID.length > 0) && (NodeID.length > 0)) {
			window.open("ProductBuilderHelp.htm?CID="+CatID+"&PID="+NodeID,"Detail","height=400,width=600,top="+top+",left="+left+",status=no,toolbar=no,menubar=no,location=no,resizable=yes,scrollbars=yes,status=no");
		}
	}
	
	  function ShowDrillDown(Page,Query){
    var left,top;
    left = (window.screen.availWidth - 530) / 2; // /2
    top=(window.screen.availHeight -450) / 2;
    window.open(Page+"?DS="+Query,"Detail","height=440,width=520,top="+top+",left="+left+",status=no,toolbar=no,menubar=no,location=no,resizable=yes,scrollbars=yes,status=no");
  }

//ProductBuilderDetail.aspx
