
/*
Simple Image Trail script- By JavaScriptKit.com
Visit http://www.javascriptkit.com for this script and more
This notice must stay intact
*/

var trailimage = ["test.gif",300,300]
var offsetfrommouse=[15,0] //image x,y offsets from cursor position in pixels. Enter 0,0 for no offset
var displayduration=0 //duration in seconds image should remain visible. 0 for always.
var compwidth = 300
var compheight = 300
var isbigcomp = 0
var isimageoftheday = 0
var isfocusclip = 0
var isinternalip = 0

// initialize global variables
var detectableWithVB = false;
var pluginFound = false;

function detectPlugin() {
    // allow for multiple checks in a single pass
    var daPlugins = detectPlugin.arguments;
    // consider pluginFound to be false until proven true
    var pluginFound = false;
    // if plugins array is there and not fake
    if (navigator.plugins && navigator.plugins.length > 0) {
	var pluginsArrayLength = navigator.plugins.length;
	// for each plugin...
	for (pluginsArrayCounter=0; pluginsArrayCounter < pluginsArrayLength; pluginsArrayCounter++ ) {
	    // loop through all desired names and check each against the current plugin name
	    var numFound = 0;
	    for(namesCounter=0; namesCounter < daPlugins.length; namesCounter++) {
		// if desired plugin name is found in either plugin name or description
		if( (navigator.plugins[pluginsArrayCounter].name.indexOf(daPlugins[namesCounter]) >= 0) || 
		    (navigator.plugins[pluginsArrayCounter].description.indexOf(daPlugins[namesCounter]) >= 0) ) {
		    // this name was found
		    numFound++;
		}   
	    }
	    // now that we have checked all the required names against this one plugin,
	    // if the number we found matches the total number provided then we were successful
	    if(numFound == daPlugins.length) {
		pluginFound = true;
		// if we've found the plugin, we can stop looking through at the rest of the plugins
		break;
	    }
	}
    }
    return pluginFound;
} // detectPlugin


// Here we write out the VBScript block for MSIE Windows
if ((navigator.userAgent.indexOf('MSIE') != -1) && (navigator.userAgent.indexOf('Win') != -1)) {
    document.writeln('<script language="VBscript">');

    document.writeln('\'do a one-time test for a version of VBScript that can handle this code');
    document.writeln('detectableWithVB = False');
    document.writeln('If ScriptEngineMajorVersion >= 2 then');
    document.writeln('  detectableWithVB = True');
    document.writeln('End If');

    document.writeln('\'this next function will detect most plugins');
    document.writeln('Function detectActiveXControl(activeXControlName)');
    document.writeln('  on error resume next');
    document.writeln('  detectActiveXControl = False');
    document.writeln('  If detectableWithVB Then');
    document.writeln('     detectActiveXControl = IsObject(CreateObject(activeXControlName))');
    document.writeln('  End If');
    document.writeln('End Function');

    document.writeln('\'and the following function handles QuickTime');
    document.writeln('Function detectQuickTimeActiveXControl()');
    document.writeln('  on error resume next');
    document.writeln('  detectQuickTimeActiveXControl = False');
    document.writeln('  If detectableWithVB Then');
    document.writeln('    detectQuickTimeActiveXControl = False');
    document.writeln('    hasQuickTimeChecker = false');
    document.writeln('    Set hasQuickTimeChecker = CreateObject("QuickTimeCheckObject.QuickTimeCheck.1")');
    document.writeln('    If IsObject(hasQuickTimeChecker) Then');
    document.writeln('      If hasQuickTimeChecker.IsQuickTimeAvailable(0) Then ');
    document.writeln('        detectQuickTimeActiveXControl = True');
    document.writeln('      End If');
    document.writeln('    End If');
    document.writeln('  End If');
    document.writeln('End Function');

    document.writeln('</scr' + 'ipt>');
}

function loadQT()
{
   if (document.getElementById || document.all) {
	document.write('<div id="trailimageid"><img src="images/spacer.gif">');
	document.write('</div>');
	gettrailobj().width=0;
	gettrailobj().height=0;
    	gettrailobj().left="-1000px"
    	gettrailobj().top="0px"
	gettrailobj().visibility="hidden"
    	gettrailobj().display=""
   }

}

loadQT()


function loadQTV()
{
   if (document.getElementById || document.all) {
	document.write('<div id="trailimageid"><img src="images/spacer.gif">');
	document.write('</div>');
	pluginFound = detectPlugin('QuickTime');
    	// if not found, try to detect with VisualBasic
    	if(!pluginFound && detectableWithVB) {
		pluginFound = detectQuickTimeActiveXControl();
    	}	
	if (pluginFound) {
  		document.getElementById("trailimageid").innerHTML = '<div style="width:0px;height:0px;padding:4px;background-color:#fff;border:1px solid #888;"><object classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" codebase="http://www.apple.com/qtactivex/qtplugin.cab#version=6,0,2,0" width="0" height="0" align="middle"> <param name="src" value="images/spacer.html"> <param name="autoplay" value="true"> <param name="bgcolor" value="#ffffff"> <embed width="0" height="0" src="/images/spacer.mov" bgcolor="#ffffff" pluginspage="http://www.apple.com/quicktime/download/"></embed></object></div>'
	} 
	gettrailobj().width=0;
	gettrailobj().height=0;
    	gettrailobj().left="-1000px"
    	gettrailobj().top="0px"
	gettrailobj().visibility="visible"
    	gettrailobj().display=""
   }

}

function gettrailobj(){
if (document.getElementById)
return document.getElementById("trailimageid").style
else if (document.all)
return document.all.trailimagid.style
}

function truebody(){
return (!window.opera && document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

function showtrail(comppath,iwidth,iheight){

//if (document.form_nav.quickview.checked) {

var maxsize = 0
var f = 0.0
var max_comp = 300
var max_bigcomp = 500
var strimagename = ""


if (comppath.indexOf("http") != -1 && comppath.indexOf("comp/index.html") != -1){
  if ( window.document.body.clientWidth < 1000 || comppath.indexOf(".jpg") == -1) {
   //comppath = "http://www.fotosearch.com/comp/" + comppath
     comppath = "/comp/"+ comppath
  } else {
   //comppath = "http://bc.fotosearch.com/bigcomps/" + comppath
   //comppath = "http://www.fotosearch.com/comp/" + comppath
     comppath = "/comp/"+ comppath
  }
}


if (comppath.indexOf("iotd") > 0) {
  // image of the day
   maxsize = max_comp
   compwidth = 300
   compheight = 300
   isimageoftheday = 1
   isfocusclip = 0
   iscleanComp = 1
   //comppath = comppath.replace("/iotd","")
   comppath = comppath.replace("iotd/index.html","http://comps.fotosearch.com/")
} else if (comppath.indexOf("focusclip") > 0) {
   //this is for illustration/clipart quickview
   isfocusclip = 0
   iscleanComp = 1   
   maxsize = max_comp
   compwidth = 300
   compheight = 300
   //comppath = comppath.replace("/focusclip","")
   comppath = comppath.replace("focusclip/index.html","http://comps.fotosearch.com/")
} else if (comppath.indexOf("focusfootage") > 0) {
   //this is for footage quickview
   isfocusclip = 1
   iscleanComp = 0
   maxsize = max_comp
   compwidth = 300
   compheight = 300
   comppath = comppath.replace("/focusfootage","")
} else if (comppath.indexOf("leancomp") > 0) { // USE LEANCOMP B/C OTHERWISE indexOf returns 0 for first position
   comppath = comppath.replace("cleancomp/index.html","http://comps.fotosearch.com/comp/")
   maxsize = max_comp
   compwidth = 300
   compheight = 300
   isimageoftheday = 0
   isfocusclip = 0
   iscleanComp = 1
} else if (comppath.indexOf("lightboxcomp") > 0) {
   comppath = comppath.replace("lightboxcomp/index.html","https://comps.fotosearch.com/comp/")
   maxsize = max_comp
   compwidth = 300
   compheight = 300
   isimageoftheday = 0
   isfocusclip = 0
   iscleanComp = 1
} else if (comppath.indexOf("bigcomps") == -1) {
   maxsize = max_comp
   compwidth = 300
   compheight = 300
   isimageoftheday = 0
   isfocusclip = 0
   iscleanComp = 0
} else {
   //big comp
   maxsize = max_bigcomp
   compwidth = 500
   compheight = 500
   isbigcomp = 1
   isimageoftheday = 0
   isfocusclip = 0
   iscleanComp = 1
}

if (comppath.indexOf("flv") > 0){
    // do nothing
} else if (iwidth == null || iheight == null || iwidth == 0 || iheight == 0) {
  if (isbigcomp = 0) {
     iwidth = 120
     iheight = 120
  } else {
     iwidth = 300
     iheight = 500
  }
}
if (iwidth > iheight) {
  f = maxsize/iwidth
  compheight = iheight * f
} else {
  f = maxsize/iheight
  compwidth = iwidth * f
}

if (isimageoftheday == 1)
   document.onmousemove=followmouse2;
else
   document.onmousemove=followmouse;

if (comppath.indexOf(".mov") > 0) {
  //video preview
  compheight = 200
  compwidth = 240
  strimagename = comppath.substring(comppath.lastIndexOf("index-2.html")+1,comppath.toLowerCase().lastIndexOf(".mov")).toUpperCase()
  document.getElementById("trailimageid").innerHTML = '<div style="width:240px;height:212px;padding:4px;background-color:#fff;border:1px solid #888;"><object classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" codebase="http://www.apple.com/qtactivex/qtplugin.cab#version=6,0,2,0" width="'+compwidth+'" height="'+compheight+'" align="middle"> <param name="src" value="'+comppath+'"> <param name="autoplay" value="true"> <param name="controller" value="true"> <param name="bgcolor" value="#ffffff"> <embed width="'+compwidth+'" height="'+compheight+'" src="'+comppath+'" bgcolor="#ffffff" pluginspage="http://www.apple.com/quicktime/download/" controller="true"></embed></object><br><b>'+strimagename+'</b></div>'

} else if (comppath.indexOf(".flv") > 0) {
  //audio preview
  if (iwidth == null || iheight == null || iwidth == 0 || iheight == 0) {
	compheight = 200
	compwidth = 240
  } else {
	compheight = iheight+25
	compwidth = iwidth
  }
  strimagename = comppath.substring(comppath.lastIndexOf("index-2.html")+1,comppath.toLowerCase().lastIndexOf(".flv")).toUpperCase()

  document.getElementById("trailimageid").innerHTML = '<div style="width:'+compwidth+'px;height:'+compheight+'px;padding:4px;background-color:#fff;border:1px solid #888;"><embed src="/includes/mediaplayer.swf" width="'+compwidth+'" height="'+compheight+'" allowscriptaccess="always" flashvars="&file='+comppath+'&height='+compheight+'&width='+compwidth+'&autostart=true" /><br><b>'+strimagename+'</b></div>'

  var dt = new Date();
  //default to 1 year
  dt.setTime(dt.getTime()+(1*24*3600*1000))
  setCookie("videoloaded",strimagename.toLowerCase(),dt,"index-2.html","","");


} else if (comppath.indexOf(".swf") > 0) {
  //flash preview
  compheight = 300
  compwidth = 260

	var flashtext = '';
	flashtext = flashtext + '<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"';
	flashtext = flashtext + '  codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" ';
	flashtext = flashtext + ' ALIGN="">';
	flashtext = flashtext + ' <PARAM NAME=movie VALUE="'+comppath+'"> <PARAM NAME=quality VALUE=medium> <PARAM NAME=bgcolor VALUE=#FFFFFF>  '; 
	flashtext = flashtext + ' <EMBED src="'+comppath+'" quality=medium bgcolor=#FFFFFF  ';
	flashtext = flashtext + ' swLiveConnect=FALSE NAME="loading" ALIGN=""';
	flashtext = flashtext + ' TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash">';
	flashtext = flashtext + ' </EMBED>';
	flashtext = flashtext + ' </OBJECT>';


  strimagename = comppath.substring(comppath.lastIndexOf("index-2.html")+1,comppath.toLowerCase().lastIndexOf(".swf")).toUpperCase()
  document.getElementById("trailimageid").innerHTML = '<div style="width:240px;height:240px;padding:4px;background-color:#fff;border:1px solid #888;">'+flashtext+'<br><b>'+strimagename+'</b></div>'


} else if (comppath.indexOf(".mp3") > 0) {
  //audio preview
  compheight = 30
  compwidth = 160
  strimagename = comppath.substring(comppath.lastIndexOf("index-2.html")+1,comppath.toLowerCase().lastIndexOf(".mp3")).toUpperCase()
  //document.getElementById("trailimageid").innerHTML = '<div style="width:160px;height:42px;padding:4px;background-color:#fff;border:1px solid #888;"><embed src="/includes/mediaplayer.swf" width="160" height="20" allowscriptaccess="always" flashvars="&file='+comppath+'&height=20&width=160&autostart=true" /><br><b>'+strimagename+'</b></div>'
  document.getElementById("trailimageid").innerHTML = '<div style="width:160px;height:42px;padding:4px;background-color:#fff;border:1px solid #888;"><object classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" codebase="http://www.apple.com/qtactivex/qtplugin.cab#version=6,0,2,0" width="'+compwidth+'" height="'+compheight+'" align="middle"> <param name="src" value="'+comppath+'"> <param name="autoplay" value="true"> <param name="controller" value="true"> <param name="bgcolor" value="#ffffff"> <embed width="'+compwidth+'" height="'+compheight+'" src="'+comppath+'" bgcolor="#ffffff" pluginspage="http://www.apple.com/quicktime/download/" controller="true"></embed></object><br><b>'+strimagename+'</b></div>'

} else if (comppath.indexOf(".fp3") > 0) {
  //audio preview
  compheight = 30
  compwidth = 160
  strimagename = comppath.substring(comppath.lastIndexOf("index-2.html")+1,comppath.toLowerCase().lastIndexOf(".fp3")).toUpperCase()
  comppath = comppath.replace(".fp3",".mp3");
  document.getElementById("trailimageid").innerHTML = '<div style="width:160px;height:42px;padding:4px;background-color:#fff;border:1px solid #888;"><embed src="/includes/mediaplayer.swf" width="160" height="20" allowscriptaccess="always" flashvars="&file='+comppath+'&height=20&width=160&autostart=true" /><br><b>'+strimagename+'</b></div>'
  //document.getElementById("trailimageid").innerHTML = '<div style="width:160px;height:42px;padding:4px;background-color:#fff;border:1px solid #888;"><object classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" codebase="http://www.apple.com/qtactivex/qtplugin.cab#version=6,0,2,0" width="'+compwidth+'" height="'+compheight+'" align="middle"> <param name="src" value="'+comppath+'"> <param name="autoplay" value="true"> <param name="controller" value="true"> <param name="bgcolor" value="#ffffff"> <embed width="'+compwidth+'" height="'+compheight+'" src="'+comppath+'" bgcolor="#ffffff" pluginspage="http://www.apple.com/quicktime/download/" controller="true"></embed></object><br><b>'+strimagename+'</b></div>'

} else if (comppath.indexOf(".txt") > 0) {
  //text tip preview
  rawtext = comppath.substring(6,comppath.toLowerCase().lastIndexOf(".txt")) // remove the .txt extension and the prefix /comp/
  compheight = rawtext.substring(0,rawtext.toLowerCase().lastIndexOf("~|"))
  textheader = rawtext.substring(rawtext.toLowerCase().lastIndexOf("~|")+2,rawtext.toLowerCase().lastIndexOf("~~")) // the header precedes ~~
  texttip = rawtext.substring(rawtext.toLowerCase().lastIndexOf("~~")+2)
  if (textheader!=""){
     document.getElementById("trailimageid").innerHTML = '<div class="fstc" style="background-color:#fff;width:'+compwidth+'px;height:'+compheight+'px;"><p class="fsth">'+textheader+'</p><p style="padding:8px;">'+texttip+'</p></div>';
  } else {
     document.getElementById("trailimageid").innerHTML = '<div class="fstc" style="background-color:#fff;width:'+compwidth+'px;height:'+compheight+'px;"><p style="padding:8px;">'+texttip+'</p></div>';
  }

} else if (comppath.indexOf(".price") > 0) {
  //text tip preview

  strimagename = comppath.substring(0,comppath.toLowerCase().lastIndexOf(".price"))
  document.getElementById("trailimageid").innerHTML = '<div id="qvp" style="width:'+compwidth+'px;height:'+compheight+'px;padding:4px;background-color:#fff;border:1px solid #888;">'+strimagename+'</div>'


} else {

  //image preview
  compheight = compheight + 12  // to display image name
  if (comppath.toLowerCase().lastIndexOf(".jpg") > 0) {
     strimagename = comppath.substring(comppath.lastIndexOf("index-2.html")+1,comppath.toLowerCase().lastIndexOf(".jpg")).toUpperCase();
  } else {
     strimagename = comppath.substring(comppath.lastIndexOf("index-2.html")+1,comppath.toLowerCase().lastIndexOf(".gif")).toUpperCase();
  }
  var imglen = strimagename.length;
  strimagename = '<br><b>' + strimagename + '</b>'

  if (isinternalip == 1) {
     //comppath = "/showcomp.aspx?imagename="+strimagename+".jpg&imagepath="+comppath.replace("/comp/","")
	//strimagename = strimagename + "/showcomp.aspx?imagename="+strimagename+".jpg&imagepath="+comppath.replace("http://www.fotosearch.com/comp/","")
	//alert(compwidth + ' ' + compheight + ' ' + f + ' ' + maxsize);
  }

  if (iscleanComp == 1) {
     strimagename = '' // IMAGE NAME IS ALREADY APPENDED TO THE CLEAN COMP
     if (imglen > 17) {
	compheight = compheight + 15;
     } else {
	compheight = compheight + 5;
     }
  }

  document.getElementById("trailimageid").innerHTML = '<div style="width:'+compwidth+'px;height:'+compheight+'px;padding:4px;background-color:#fff;border:1px solid #888;"><img src="'+comppath+'" border="0">'+strimagename+'</div>'

}

if (iwidth != 0 && iheight != 0){
//gettrailobj().width=iwidth;
//gettrailobj().height=iheight;}
gettrailobj().width=compwidth;
gettrailobj().height=compheight;}
gettrailobj().visibility="visible";

//}

}

function hidetrail(){
//document.getElementById("trailimageid").innerHTML = ''
gettrailobj().visibility="hidden"
gettrailobj().left="-1000px"
document.onmousemove=""
}

function hidetrail_v(){
  compheight = 30
  compwidth = 160
  gettrailobj().visible="none"
  gettrailobj().display=""
  gettrailobj().visibility="hidden"
  gettrailobj().left="-1000px"
  document.getElementById("trailimageid").innerHTML = '<div style="width:160px;height:42px;padding:4px;background-color:#fff;border:1px solid #888;"><object classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" codebase="http://www.apple.com/qtactivex/qtplugin.cab#version=6,0,2,0" width="0" height="0" align="middle"> <param name="src" value="images/spacer.html"> <param name="autoplay" value="true"> <param name="controller" value="true"> <param name="bgcolor" value="#ffffff"> <embed width="0" height="0" src="/images/spacer.mov" bgcolor="#ffffff" pluginspage="http://www.apple.com/quicktime/download/" controller="true"></embed></object><br></div>'
  document.onmousemove=""
}

function followmouse(e){
  var xcoord=offsetfrommouse[0]
  var ycoord=offsetfrommouse[1]
  if (isbigcomp == 1) {
     trailimage[1] = 500;
     trailimage[0] = 500;
  }
  var docwidth=document.all? truebody().scrollLeft+truebody().clientWidth : pageXOffset+window.innerWidth-15
  var docheight=document.all? Math.min(truebody().scrollHeight, truebody().clientHeight) : Math.min(document.body.offsetHeight, window.innerHeight)

  //if (docwidth < xcoord+trailimage[1] || docheight < truebody.scrollTop+trailimage[1]) {
    //gettrailobj().visible="none"
  //}
  //} else {
  
    if (typeof e != "undefined") {
      // Mozilla
      xcoord+=e.pageX
      ycoord+=e.pageY
      if (xcoord+trailimage[1] >docwidth)
        xcoord = e.pageX - compwidth - offsetfrommouse[0]
      if (ycoord+trailimage[1]+27> docheight + truebody().scrollTop)
        ycoord = (truebody().scrollTop+docheight) - compheight - 35

	//always show big-comp even if it doesn't quite fit
	if (ycoord <= 0 && isbigcomp == 1)
	   ycoord = truebody().scrollTop
	if (xcoord <= 0 && isbigcomp == 1)
	   xcoord = e.pageX+trailimage[1]

      // this is to move the .top up if it is too far down from the mouse pointer
      if (ycoord > (truebody().scrollTop+e.pageY) + 10)
         ycoord  = ycoord  - (ycoord - (truebody().scrollTop+e.pageY))


      // center all clips from the homepage link to the focus video page
      if (isfocusclip == 1)
	 ycoord = ycoord - 100

    }
    else if (typeof window.event !="undefined") {
      // IE browser
      xcoord+=truebody().scrollLeft+event.clientX
      ycoord+=truebody().scrollTop+event.clientY

      if (xcoord+trailimage[1] > docwidth) 
        xcoord = (truebody().scrollLeft+event.clientX) - compwidth - offsetfrommouse[0]
      if (ycoord+trailimage[1]+27 > docheight + truebody().scrollTop) 
        ycoord = (truebody().scrollTop+docheight) - compheight - 27

	//always show big-comp even if it doesn't quite fit
	if (ycoord <= 0 && isbigcomp == 1)
	   ycoord = (truebody().scrollTop)
	if (xcoord <= 0 && isbigcomp == 1)
	   xcoord = (truebody().scrollLeft+event.clientX)+offsetfrommouse[0]


      // this is to move the .top up if it is too far down from the mouse pointer
      if (ycoord > (truebody().scrollTop+event.clientY) + 10)
         ycoord  = ycoord  - (ycoord - (truebody().scrollTop+event.clientY))

      // center all clips from the homepage link to the focus video page
      if (isfocusclip == 1)
	 ycoord = ycoord - 100
    }


  //}

  if (xcoord < 0 || ycoord < 0) {
    gettrailobj().visible="none"
    gettrailobj().display=""
  } else {
    gettrailobj().display=""
    gettrailobj().left=xcoord+"px"
    gettrailobj().top=ycoord+"px"
  }  
}

function followmouse2(e){
  var xcoord=offsetfrommouse[0]
  var ycoord=offsetfrommouse[1]
  if (isbigcomp == 1) {
     trailimage[1] = 500;
     trailimage[0] = 500;
  }
  var docwidth=document.all? truebody().scrollLeft+truebody().clientWidth : pageXOffset+window.innerWidth-15
  var docheight=document.all? Math.min(truebody().scrollHeight, truebody().clientHeight) : Math.min(document.body.offsetHeight, window.innerHeight)

  //if (docwidth < xcoord+trailimage[1] || docheight < truebody.scrollTop+trailimage[1]) {
    //gettrailobj().visible="none"
  //}
  //} else {
  
    if (typeof e != "undefined") {
      // Mozilla
      xcoord+=e.pageX
      ycoord+=e.pageY

    }
    else if (typeof window.event !="undefined") {
      // IE browser
      xcoord+=truebody().scrollLeft+event.clientX
      ycoord+=truebody().scrollTop+event.clientY
    }


  //}

  if (xcoord < 0 || ycoord < 0) {
    gettrailobj().visible="none"
    gettrailobj().display=""
  } else {
    gettrailobj().display=""
    gettrailobj().left=xcoord+"px"
    gettrailobj().top=ycoord+"px"
  }  
}

function quickview_onClick()
{
   var dt = new Date();
   //default to 1 year
   dt.setTime(dt.getTime()+(365*24*3600*1000))
   if (document.form_nav.quickview.checked) {
	setCookie("quickview","yes",dt,"index-2.html","","");
   } else {
	setCookie("quickview","no",dt,"index-2.html","","");
   }
}

function setCookie(name, value, expires, path, domain, secure) {
  var curCookie = name + "=" + escape(value) +
      ((expires) ? "; expires=" + expires.toGMTString() : "") +
      ((path) ? "; path=" + path : "") +
      ((domain) ? "; domain=" + domain : "") +
      ((secure) ? "; secure" : "");
  document.cookie = curCookie;
}

   var xmlHttp;
   var infoid;

function infopop(id){ 

  infoid = id;

  if (infoid.length > 0)
  { 
    var url="infopop5445.html?id="+infoid
    xmlHttp=GetXmlHttpObjecti(stateChangedi)
    xmlHttp.open("GET", url , true)
    xmlHttp.send(null)
  }
  else
  { 
    //nothing
  } 
} 

function stateChangedi() 
{ 
  if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
  { 
    var infodetail = xmlHttp.responseText
    //document.getElementById(infoid).innerHTML= "<script>showtrail('"+infodetail+".txt',300,300);</script>"
    showtrail(infodetail+'.txt',300,300);
  } 
} 

function GetXmlHttpObjecti(handler)
{ 
  var objXmlHttp=null

  if (navigator.userAgent.indexOf("MSIE")>=0)
  { 
    var strName="Msxml2.XMLHTTP"
    if (navigator.appVersion.indexOf("MSIE 5.5")>=0)
    {
      strName="Microsoft.XMLHTTP"
    } 
    try
    { 
      objXmlHttp=new ActiveXObject(strName)
      objXmlHttp.onreadystatechange=handler 
      return objXmlHttp
    } 
    catch(e)
    { 
      //alert("Error. Scripting for ActiveX might be disabled") 
      return 
    } 
  } 
  if (navigator.userAgent.indexOf("Mozilla")>=0 || navigator.userAgent.indexOf("Opera")>=0)
  {
    objXmlHttp=new XMLHttpRequest()
    objXmlHttp.onload=handler
    objXmlHttp.onerror=handler 
    return objXmlHttp
  }
} 



