// JavaScript Document 1.0 Compatible

// Module: 			JavaScript Library
// Description:		Contains some basic JavaScript functions used throughout the site.
// Author:			Jon Beattie (jon@theoutfit.co.nz), The Outfit Ltd (www.theoutfit.co.nz)
// Date:			17 November 2003

<!--

// Function: 		openWin( windowURL, windowName, windowFeatures )
// Description:		Opens a new browser window
var b_open=false;
var win_jpg;

function URLencode(sStr) {
    return escape(sStr).replace(/\+/g, '%2C').replace(/\"/g,'%22').replace(/\'/g, '%27');
  }



function openWin( windowURL, windowName, windowFeatures ) { 
	var v_link=new String();
	var v_winname=new String();	
	var v_img_dir;
	v_link=windowURL;	
	if (v_link.substr(v_link.length-3,3).toLowerCase()=="jpg")
	{
	    if (b_open==true)
    	  win_jpg.close();
		v_winname=windowName;		  
		if (v_winname.substr(0,1)=="1")  //Offline
			v_img_dir="";
		else
			v_img_dir="../";				  
	    b_open=true;
//	    win_jpg = window.open("","win_jpg","scrollbars=yes,width=400,height=400,screenX=0,screenY=0,top=10,left=10"); 
	    win_jpg = window.open("","win_jpg",windowFeatures); 
		v_winname=v_winname.substr(1,v_winname.length-1);
		win_jpg.document.write("<html><body>");
		win_jpg.document.write("<form action=\"../techinfo.asp?name="+v_winname.replace(" ","_")+" \" name=\"frm_img\" method=\"post\">");
		win_jpg.document.write("<input type=\"Hidden\"  name=\"namex\" value=\""+v_winname+"\">");
		win_jpg.document.write("<input type=\"Hidden\"  name=\"img_url\" value=\""+windowURL+"\">");
		win_jpg.document.write("</form></body></html>");
		win_jpg.document.forms["frm_img"].submit();		
		return win_jpg;		
		
//		win_jpg.document.write("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">");		
	    win_jpg.document.write("<html>");
    	win_jpg.document.write("<head>");
		win_jpg.document.write("<title>"+"Welcome to TradeSmart"+"</title>");
		win_jpg.document.write("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=windows-1252\">");
		win_jpg.document.write("<link href=\""+v_img_dir+"style/style.css\" rel=\"stylesheet\" type=\"text/css\">");
		win_jpg.document.write("<script language='javascript' >var reloaded=false;</script>");
    	win_jpg.document.write("</head>");
	    win_jpg.document.write("<body class=\"bodyPopup\" >");
		win_jpg.document.write("<table width=\"575\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">");
		win_jpg.document.write("<tr><td valign=\"top\">");
		win_jpg.document.write("<div align=\"right\"><a href=\"JavaScript:window.close();\"><img src=\""+v_img_dir+"images/button_close.gif\" alt=\"Close\" width=\"89\" height=\"39\" hspace=\"0\" vspace=\"0\" border=\"0\"></a><a href=\"JavaScript:if (reloaded==false) window.location.reload();reloaded=true;window.print();\"><img src=\""+v_img_dir+"images/button_print.gif\" alt=\"Print\" width=\"89\" height=\"39\" hspace=\"0\" vspace=\"0\" border=\"0\"></a></div>");
		win_jpg.document.write("<div><img src=\""+v_img_dir+"images/div_lightblue.gif\" alt=\"Rinnai\" width=\"100%\" height=\"2\" hspace=\"0\" vspace=\"0\" border=\"0\"></div>");
		win_jpg.document.write("<h1>"+v_winname.substr(1,v_winname.length-1)+"</h1>");
		win_jpg.document.write("<div><img src=\""+v_img_dir+"images/div_lightblue.gif\" alt=\"Rinnai\" width=\"100%\" height=\"2\" hspace=\"0\" vspace=\"0\" border=\"0\"></div>");
		win_jpg.document.write("</td></tr></table><br>");
		win_jpg.document.write("<img src='"+windowURL+"'>")		
	    win_jpg.document.write("</body>");
    	win_jpg.document.write("</html>");
		return win_jpg;
//		return window.open( "../show_img.asp?img="+windowURL, windowName, windowFeatures ) ; 	
	}
	else
		return window.open( windowURL, windowName, windowFeatures ) ; 
} 

// Function: 		MM_displayStatusMsg(msgStr)
// Description:		Displays status message in the browser window

function MM_displayStatusMsg(msgStr)  { //v3.0
	status=msgStr; document.MM_returnValue = true;
}

// Function: 		MM_findObj(n, d)
// Description:		Finds an object across different frames (if applicable)

function MM_findObj(n, d) { //v3.0
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
	d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document); return x;
}

// Function: 		MM_swapImage()
// Description:		Swaps an image

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

// Function: 		MM_swapImgRestore()
// Description:		Restores an image

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

// Function: 		MM_preloadImages()
// Description:		Preloads images that will be used for mouseovers so they don't have to download onMouseOver command.
//					Normally called by onLoad()

function MM_preloadImages() { //v3.0
 var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
   var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
   if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}


-->