/*
-----------------------------------------------------------------------------------------------------------------------
# Name:			webseals/newsi.js 
# Description:	This page contains JavaScript code that is referenced by the customer's website. This code takes care
#				of loading the WebLogo image on the customer's site and also provides a hyper-link for that WebLogo
#				image which opens RWSroot/sealTarget.asp on the RWS webserver.
#
# Author:		Teegala
# History:
#	02-04-2003	Teegala		Page Created 
#   06-05-2003	Teegala		Added check in gt_md function for whether the webseal image has loaded. If not,
#							the seal is invalid, and the link to sealTarget is deactivated.
#   06-10-2003	Teegala		Added the strLang parameter to the querystring (passed from the seal) to define the
#							language used on sealTarget.asp
#	06-20-2003	GMcDonald	Added a check for the strLang lanugage parameter, so old seals not passing this
#							parameter would default to English.
#	06-24-2003	Teegala		Need to increase the Height of the SealTaget.asp page incase of French Version display.
#							Need to check for country. Increased height of SealTarget.asp page to 323.
#	07-03-2003	Teegala		To handle address with more no of lines, increased the height of SealTarget.asp page.
-----------------------------------------------------------------------------------------------------------------------
*/
gt_ua=navigator.userAgent.toLowerCase();
gt_isie=(gt_ua.indexOf("msie")!=-1);
gt_isop=(gt_ua.indexOf("opera")!=-1);
gt_bma=parseInt(navigator.appVersion);
gt_s="seal";
if (typeof(strLang) == 'undefined') strLang="EN"; //older webseals won't pass a language parameter, so default to English
gt_rsip="https://"+strRWSPath+"/sealtarget.asp?Language="+ strLang +"&sealID="+sealID+"&key="+strDuns+"&country="+strCountry+"&cmeid=EOR100276";
gt_is="https://"+strSealURL+"/webseal.asp?sealID="+sealID+"&increment="+increment;
iHeight=336;
if(strLang == 'FR' && strCountry == 'CA' ){
iHeight=359;
}
gt_ws="left=260,top=180,width=500,height="+iHeight+",location=0,status=0,toolbar=0,menubar=0,scrollbars=0,resize=1";
gt_rcm="This icon is protected.\nPlease use left button to view company information.";
gt_msg="Click for company profile";
gt_w=null;
if(gt_ua.indexOf("msie 5")!=-1)gt_bma=5;
if(gt_ua.indexOf("msie 6")!=-1)gt_bma=6;
if(gt_ua.indexOf("msie 7")!=-1)gt_bma=7;
function gt_sp(){
 gt_w=window.open(gt_rsip,'GTSIP',gt_ws);
 if ( gt_w != null ) gt_w.focus();
}
function gt_dc(e){

 if (gt_isop||document.addEventListener) {
	  var eit=(e.target.name=="gtsi");
	  if (eit)	  {
		if (e.which==3)	{
			//alert(gt_rcm);
			return false;
		}else if(e.which==1){
			gt_sp();
			return false;
	    }
       }
  }else if(document.captureEvents){
  	  var tgt=e.target.toString();
	  var eit=(tgt.indexOf(gt_s)!=-1);
	  if (eit){
		if (e.which==3){
			alert(gt_rcm);
			return false;
			}else if(e.which==1){
			gt_sp();
			return false;
	    }
       }
   }
  return true;
}

function gt_md(e){
 //We can check whether the image has been loaded into IMG object or not.
 //If the SealID is valid then complete property of image would contain true and false incase of invalid.
 if(document.images.gtsi.complete == false) 
 {
   return false;//When the WebSeal is invalid.
 }
 if(typeof event != 'undefined'){  if (event.button==2){
  alert(gt_rcm);
  return false;
 }else if(event.button==1){
  if(gt_isie&&(gt_bma<=4)) {
   return true;
  }else{
   gt_sp();
   return false;
  }
 }}
 return false;
}
if(gt_isie&&(gt_bma<=4)) {
 document.write("<A TABINDEX=\"-1\" HREF=\""+gt_rsip+"\" onmousedown=\"return gt_md();\"><IMG NAME=\"gtsi\" HEIGHT='60' WIDTH='180' BORDER=\"0\" SRC=\""+gt_is+"\" ALT=\""+gt_msg+"\" oncontextmenu=\"return false;\"></A>");
}
else if(gt_isie&&(gt_bma>=5)&&!gt_isop) {
 document.write("<A TABINDEX=\"-1\" onmouseout=\"window.status='';\" onmouseover=\"this.style.cursor='hand'; window.status='"+gt_msg+"';\" onmousedown=\"return gt_md();\"><IMG NAME=\"gtsi\" HEIGHT='60' WIDTH='180' BORDER=\"0\" SRC=\""+gt_is+"\" ALT=\""+gt_msg+"\" oncontextmenu=\"return false;\"></A>");
}
else { 
 document.write("<A TABINDEX=\"-1\" HREF=\""+gt_rsip+"\" onclick=\"return gt_md();\" target=\"GTSIP\"><IMG NAME=\"gtsi\" HEIGHT=\"60\" WIDTH=\"180\" BORDER=\"0\" SRC=\""+gt_is+"\" ALT=\""+gt_msg+"\" oncontextmenu=\"return false;\"></A>");
}
if (document.addEventListener){
 document.addEventListener('mouseup',gt_dc,true);
}
else {
 if (document.layers){
  document.captureEvents(Event.MOUSEDOWN);
 }
 document.onmousedown=gt_dc;
}
