/* author: neolithic */
/* Creation date: 14/01/2004 */
// this is all the javascript from thsw homepage


function AFProcessSaleTHSW(orderRef, payoutCodes, echo)
{
var merchantID = 547;
var orderValue = 0;
var offlineCode = '';
var RN = new String (Math.random());
var RNS = RN.substring (2, 11);
var TrackURL = 'http://scripts.affiliatefuture.com/AFSaleV2.asp?orderID='+orderRef+'&orderValue='+orderValue+'&merchant='+merchantID+'&payoutCodes='+payoutCodes+'&offlineCode='+offlineCode+'&r='+RNS+'&img=0';


 if (TodayActions < 2) {
	// this code is subject to click protection
  	if (document.getElementById) {
   	document.getElementById('TrackFrame').src = TrackURL;
  	}
  	else if (document.all) {
    	document.frames['TrackFrame'].src = TrackURL;
  	}
  	else if (document.layers) {
    	document.TrackLayer.load(TrackURL,0);
  	}
  	
  	if (echo==1) {
		alert('AffiliateFuture testing: The following TrackURL has been called: ' + TrackURL);  		
  	}
  }
  
 TodayActions = TodayActions + 1;

}

function WriteBWcookie()
{
	var bw = BrowseWidth();
//	alert("width=" + bw);
 	document.cookie = "BW=" + bw ;
}


function timestamp(){
// makes random numbers to prevent banner caching
var rnd = (Math.round((Math.random()*1234567)+1));
return rnd;
}

function ResizePop(width, height) {
if ((navigator.userAgent.indexOf('XP') > -1) || (navigator.userAgent.indexOf('Windows 5.1') > -1)) {
	height = height + 25;
	// width = width + 5;
}
var maxHeight = window.screen.availHeight;
if (height > maxHeight) { 
	height = maxHeight;
}
if (navigator.appName=="Netscape") {
	window.outerWidth=width;
	window.outerHeight=height;
	}
else {
	window.resizeTo(width,height);
	}
}

function BrowseWidth() {

if (self.innerHeight) // all except Explorer
{
	return self.innerWidth;
}
else if (document.documentElement && document.documentElement.clientHeight)
	// Explorer 6 Strict Mode
{
	return document.documentElement.clientWidth;
}
else if (document.body) // other Explorers
{
	return document.body.clientWidth;
}

}


function addbookmark()
{
/* add bookmark after onServerClick event is tracked*/
bookmarkurl="http://www.thehighstreetweb.com?ref=bookmark";
bookmarktitle="the highstreet web";
if (document.all)
window.external.AddFavorite(bookmarkurl,bookmarktitle);
}

function faq()
{
/* pop up the faq page */
window.open('http://www.thehighstreetweb.com/faq.html','FAQ','toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=yes,resizable=0,width=805,height=600,screenX=50,screenY=100,left=100,top=100');
}

function privacy()
{
/* pop up the privacy statement */
window.open('http://www.thehighstreetweb.com/html/content/privacy.aspx?style='+style,'Privacy_Statement','toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=yes,resizable=0,width=720,height=600,screenX=100,screenY=100,left=100,top=100');
}

function terms()
{
/* pop up the terms of useage */
window.open('http://www.thehighstreetweb.com/html/content/terms.aspx?style='+style,'Terms_and_Conditions','toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=yes,resizable=0,width=720,height=600,screenX=100,screenY=100,left=100,top=100');
}

function showhint(msg)
{
var cleanmsg = unescape(msg);
window.status = cleanmsg;
}

function FixNetscapeLayers() {
    document.layers['netscape'].top = 100;
    document.layers['netscape'].left =  100;
    setTimeout('FixNetscapeLayers()',100);
}

function ProcessClick(params) {
today = new Date();
mytime = today.getTime();
var newwin = OpenWindow(baseurl + 'click.aspx?'+clickparams+'&'+params, 'click'+mytime);
return newwin;
}

function OpenWindow(url, windowname) {
// generic function
mywidth = window.screen.availWidth+8;
myheight = window.screen.availHeight+8;
if (mywidth > 1200) mywidth = 1200;
if (myheight > 800) myheight = 800;
var newwin = window.open(url, windowname, 'toolbar=1,location=1,directories=1,status=1,menubar=1,scrollbars=1,resizable=1,width='+mywidth+',height='+myheight+',screenX=0,screenY=0,left=0,top=0');
newwin.moveTo(-4,-4);
return newwin;
}

function CurrentFeaturedKeywordID(searchterm) {
  var keywordid = 0;
  for (var i=0; i<currentfk.length; i++)
  if (currentfk[i] == searchterm.toLowerCase()) {
		keywordid = currentfkid[i];
	}
  return keywordid;
}

function PopFullPageSSF(menu){
	today = new Date();
	mytime = today.getTime();
	newlocation = baseurl + menu + '?f=1&ssf=1&' + pageParams;
	newwin = OpenWindow(newlocation, 'THSWFull'+mytime);
	newwin.focus();
	window.close();
}

function PopFullPage(menu){
	today = new Date();
	mytime = today.getTime();
	newlocation = baseurl + menu + '?f=1&' + pageParams;
	newwin = OpenWindow(newlocation, 'THSWFull'+mytime);
	newwin.focus();
	window.close();
}


function HotSpotNew(keywordID,order,urlparams) {
// clicked on a hotspot
var suppressSearchfocus = '';
if (order==1) {
	var newwin = ProcessClick('Keyword='+keywordID);
	suppressSearchfocus = '&ssf=1';
	}
if (portal==1) {
	newlocation = baseurl + urlparams + '&' + pageParams + suppressSearchfocus;
	window.location=newlocation;
	} 
else {
	newlocation = baseurl + urlparams + '&' + pageParams + '&f=1' + suppressSearchfocus;
	OpenWindow(newlocation, 'THSWFull');
	window.close();
	}
if (order==1) {
	newwin.focus();
	}
}

var message="To add to your favourites, please click 'Bookmark this site' at the bottom of the page.";

function aclick(e) {
	if (document.all) {
    	if (event.button==2||event.button==3) {
        	alert(message);
            return false;
          }
	}
	if ((document.layers)||(window.navigator.userAgent.toLowerCase().indexOf('gecko') != -1)) {
     	if (e.which == 3) {
        	alert(message);
            return false;
    	}
	}
}

if ((document.layers)||(window.navigator.userAgent.toLowerCase().indexOf('gecko') != -1)) {
   document.captureEvents(Event.MOUSEDOWN);
}
//document.onmousedown=aclick;

// show or hide elements 
function showMore(id) { 
	document.getElementById(id).style.display = 'block';  
}

function hideMore(id) {
	document.getElementById(id).style.display = 'none';
}


// Body onload utility (supports multiple onload functions) 
var TS_gSafeOnload = new Array(); 

function TS_SafeAddOnload(f) 
{ 
        if  (window.onload) 
        { 
                if (window.onload != TS_SafeOnload) 
                { 
                        TS_gSafeOnload[0] = window.onload; 
                        window.onload = TS_SafeOnload; 
                }               
                TS_gSafeOnload[TS_gSafeOnload.length] = f; 
        } 
        else 
                window.onload = f; 
} 

function TS_SafeOnload() 
{ 
        for (var i=0;i<TS_gSafeOnload.length;i++) 
                TS_gSafeOnload[i](); 
} 
