 function checkurl()
{
var myurl = "http://www.tekmor.gr";
if(document.referrer.substring(0,26) == myurl)
{document.location.href=document.referrer;}
else
{document.location.href=myurl;}
}

var ie=document.all;
var ns6=document.getElementById&&!document.all;


// set the counter so we alwas start at 1 and can update as we go along
var myThumbCounter = 1;

function ietruebody(){
return (document.compatMode && document.compatMode!="BackCompat" && !window.opera)? document.documentElement : document.body;
}

function enlarge(which,myDivId){

if (ie||ns6){
crossobj= document.getElementById(myDivId) ;
if (crossobj==null)
crossobj= document.getElementById(myDivId) ;
}

crossobj.innerHTML='<img src="'+which+'" align=center>';
crossobj.style.visibility="visible";
return false;

}

function showImageInfo(title, description, myDivId){

document.getElementById(myDivId) .innerHTML= description;
return false;
}



/* add border function */

var myLastImg = '';

function switchBorder(myDiv,uniqueID) {

document.getElementById(myDiv).className='jwpVideoMenuItemOn';

if (myLastImg != '') {
document.getElementById(myLastImg).className='jwpVideoMenuItemOff';
}

if(myDiv== myLastImg) {
document.getElementById(myDiv).className='jwpVideoMenuItemOn';
}

//document.getElementById(myDiv).focus();

myLastImg = myDiv;
myThumbCounter = uniqueID;
}


/* add border function */

var myLastImg = '';

function switchCompBorder(myDiv,uniqueID) {

document.getElementById(myDiv).className='jwpCompVideoMenuItemOn';

if (myLastImg != '') {
document.getElementById(myLastImg).className='jwpCompVideoMenuItemOff';
}

if(myDiv== myLastImg) {
document.getElementById(myDiv).className='jwpCompVideoMenuItemOn';
}

//document.getElementById(myDiv).focus();

myLastImg = myDiv;
myThumbCounter = uniqueID;
}

/* THUMBNAIL ARRAY */


var myThumbsArray = new Array();

function switchBack() {

var actualSize = myThumbsArray.length; 

if(myThumbCounter>1){
myThumbCounter--;
} else {
myThumbCounter = actualSize-1;
}

thumbTitle = myThumbsArray[myThumbCounter]["thumbTitle"];
thumbDesc = myThumbsArray[myThumbCounter]["thumbDesc"];
thumbImage = myThumbsArray[myThumbCounter]["thumbImage"];
thumbImageDiv = myThumbsArray[myThumbCounter]["thumbImageDiv"];


enlarge(thumbImage,'macGalleryImagePhotos');
showImageInfo(thumbTitle, '', 'macGalleryTitle');
showImageInfo('', thumbDesc, 'macGalleryDesc');
switchBorder(thumbImageDiv, myThumbCounter); 
}

function switchNext() {

var actualSize = myThumbsArray.length; 

if(actualSize -1> myThumbCounter){
myThumbCounter++;
} else {
myThumbCounter = 1;
}

thumbTitle = myThumbsArray[myThumbCounter]["thumbTitle"];
thumbDesc = myThumbsArray[myThumbCounter]["thumbDesc"];
thumbImage = myThumbsArray[myThumbCounter]["thumbImage"];
thumbImageDiv = myThumbsArray[myThumbCounter]["thumbImageDiv"];

enlarge(thumbImage,'macGalleryImagePhotos');
showImageInfo(thumbTitle, '', 'macGalleryTitle');
showImageInfo('', thumbDesc, 'macGalleryDesc');
switchBorder(thumbImageDiv, myThumbCounter); 
}









 /*
PAGING CODE - GROUPS DIVS INTO PAGES
this is the code used to generate a 'virtual paging' system.
These functions are used in conjunction with the js code
that is found in the ARTICLE MENU elements. Comprises
of:
1. global js variables
2. function pageLinkMaker() 
3. function linkManager()
4. function injectHTML()
5. function pageSwitcher()
*/

//gloabal varialbes used by pageLinkMaker(),
//linkManager() and the pageSwitcher() functions
var currentPage;
var previousPage;
var pagesRequired;
var my_div = null;
var newDiv = null;
var firstLoad = 0;

function injectHTML(htmlString) {

  //document.getElementById("pageNumbersBtm").innerHTML=htmlString;
  
  //DOM SCRIPTING
  /*var node=document.getElementById("hpDefaultArticleBox");
  var pagingDiv = document.getElementById("pageNumbersBtm");

  if (node.childNodes[2]!=null) {
    node.removeChild(node.childNodes[2]);
  }
  
  //var oDiv=document.createElement("DIV");
  //oDiv.innerHTML=htmlString;
  
  //trying to appendChild with pagingDiv instead of newly created div oDiv
  pagingDiv.innerHTML='hello';  
  node.appendChild(pagingDiv);*/

//ANOTHER ATTEMPT - using document.write within DIV - problem with 2nd page
//paging not appearing b.c of innerHTML being used
/*if (firstLoad==0) {
document.write(htmlString);
firstLoad++;
} else {
document.getElementById("pageNumbersBtm").outerHTML='<pre>'+htmlString+'</pre>';
}*/

//document.getElementById("pageNumbersBtm").innerHTML=htmlString;
var temp = document.getElementById("pageNumbersBtm");

//alert(temp.innerHTML);
temp.innerHTML=htmlString;
//alert(temp.innerHTML);

  //var tb = document.getElementsByName('tb')[0];
  //tb.parentNode.replaceChild(temp.firstChild.firstChild, tb);
}

//STEP2: here we make the links for the pages
function linkManager(currentPageIn, selectedPage) {
  pageNum = currentPageIn.split('page');
  previousPageNum = parseInt(pageNum[1]) - 1;
  nextPageNum = parseInt(pageNum[1]) + 1;

  var pageLinks="";
  var openAtag="<a href='#' onclick='pageSwitcher(page";
  var cloaseAtag="</a>";
  var firstPageLink="<a href='#' onclick='pageSwitcher(page1)'>First</a>";
  var lastPageLink="<a href='#' onclick='pageSwitcher(page"+pagesRequired+")'>Last</a>";
  var previousPageLink="<a href='#' onclick='pageSwitcher(page"+previousPageNum+")'>Previous</a>";
  var nextPageLink="<a href='#' onclick='pageSwitcher(page"+nextPageNum+")'>Next</a>";
  for(i=1; i<=pagesRequired; i++){
    //when making page link for current page to not add href
    (pageNum[1]==i)?pageLinks=pageLinks+i+" | ":pageLinks=pageLinks+openAtag+i+");'>"+i+cloaseAtag+" | ";		
  }
		
  //configure when links are appear
  var firstLink="First";
  var previousLink="Previous";
  var nextLink="Next";
  var lastLink="Last";

  //configure when the First link is active
  ((pagesRequired>1)&&(currentPage.id!='page1'))?firstLink=firstPageLink:firstLink=firstLink;
  //configure when the Last link is active
  ((pagesRequired>1)&&(currentPage.id!='page'+pagesRequired))?lastLink=lastPageLink:lastLink=lastLink;
  //configure when the Next link is active
	((pagesRequired>1)&&(currentPage.id!='page'+pagesRequired))?nextLink=nextPageLink:nextLink=nextLink;
  //configure when the previous link is active
	((pagesRequired>1)&&(currentPage.id!='page1'))?previousLink=previousPageLink:previousLink=previousLink;
		
  //set default links for 1 page view
  (pagesRequired<=1)?pageLinks="Page: 1 |   of  1 - First | Previous | Next | Last":pageLinks="Page: "+pageLinks+"  of  "+pagesRequired+" - "+firstLink+" | "+previousLink+" | "+nextLink+" | "+lastLink;

  injectHTML(pageLinks);		
}
/*GREEK VERSION*/
function linkManagerGR(currentPageIn, selectedPage) {
  pageNum = currentPageIn.split('page');
  previousPageNum = parseInt(pageNum[1]) - 1;
  nextPageNum = parseInt(pageNum[1]) + 1;

  var pageLinks="";
  var openAtag="<a href='#' onclick='pageSwitcherGR(page";
  var cloaseAtag="</a>";
  var firstPageLink="<a href='#' onclick='pageSwitcherGR(page1)'>Πρώτη</a>";
  var lastPageLink="<a href='#' onclick='pageSwitcherGR(page"+pagesRequired+")'>Τελευταία</a>";
  var previousPageLink="<a href='#' onclick='pageSwitcherGR(page"+previousPageNum+")'>Προηγούμενη</a>";
  var nextPageLink="<a href='#' onclick='pageSwitcherGR(page"+nextPageNum+")'>Επόμενη</a>";
  for(i=1; i<=pagesRequired; i++){
    //when making page link for current page to not add href
    (pageNum[1]==i)?pageLinks=pageLinks+i+" | ":pageLinks=pageLinks+openAtag+i+");'>"+i+cloaseAtag+" | ";		
  }
		
  //configure when links are appear

  var firstLinkGR="Πρώτη";
  var previousLinkGR="Προηγούμενη";
  var nextLinkGR="Επόμενη";
  var lastLinkGR="Τελευταία";
	
  //configure when the First link is active
  ((pagesRequired>1)&&(currentPage.id!='page1'))?firstLinkGR=firstPageLink:firstLinkGR=firstLinkGR;
  //configure when the Last link is active
 ((pagesRequired>1)&&(currentPage.id!='page'+pagesRequired))?lastLinkGR=lastPageLink:lastLinkGR=lastLinkGR;
  //configure when the Next link is active
  ((pagesRequired>1)&&(currentPage.id!='page'+pagesRequired))?nextLinkGR=nextPageLink:nextLink=nextLinkGR;	
  //configure when the previous link is active
  ((pagesRequired>1)&&(currentPage.id!='page1'))?previousLinkGR=previousPageLink:previousLink=previousLinkGR;
		
  //set default links for 1 page view
  (pagesRequired<=1)?pageLinks="Σελίδα: 1 |   από  1 - Πρώτη | Προηγούμενη | Επόμενη | Τελευταία":pageLinks="Σελίδα: "+pageLinks+"  από  "+pagesRequired+" - "+firstLinkGR+" | "+previousLinkGR+" | "+nextLinkGR+" | "+lastLinkGR;
  
  injectHTML(pageLinks);		
}



/*
STEP1: here we calculate how many pages will be 
required using the JS Math round method. The call
to this function is done once all the divs have been
generated and placed into page holder divs (done by
the element)
*/

function pageLinkMaker(count, divsperPage) {
  
  pagesRequired = Math.ceil(count/divsperPage);
  
  firstPageDiv=document.getElementById('page1');
  currentPage=firstPageDiv;
  //linkManager handles the page links
  linkManager(firstPageDiv.id, firstPageDiv.id);
}
/*GREEK VERSION*/
function pageLinkMakerGR(count, divsperPage) {
  pagesRequired = Math.ceil(count/divsperPage);
  firstPageDiv=document.getElementById('page1');
  currentPage=firstPageDiv;
  //linkManager handles the page links
  linkManagerGR(firstPageDiv.id, firstPageDiv.id);
}


/*
pageSwithcer is called everytime the user clicks on
one of the page links (page number, first, last, previous

next)
*/
function pageSwitcher(selectedPage) {
  previousPage = currentPage;
  document.getElementById(currentPage.id).style.display='none';
  document.getElementById(selectedPage.id).style.display='block';
  currentPage = selectedPage;
  linkManager(currentPage.id, selectedPage.id);
}
/*GREEK VERSION*/
function pageSwitcherGR(selectedPage) {
  previousPage = currentPage;
  document.getElementById(currentPage.id).style.display='none';
  document.getElementById(selectedPage.id).style.display='block';
  currentPage = selectedPage;
  linkManagerGR(currentPage.id, selectedPage.id);
}

  var registrationBlank1EN ='The field ';
var registrationBlank2EN =' is required.';

var contactFrmFlds =new Array("First_Name","Last_Name", "e_mail","Message");
var contactFrmFldsTxt =new Array("First Name","Last Name", "Email","Message");

var errString = '';

function alertUser(errorType,errorLang) {

 if((errorType>=14) && (errorType<19)) {
  txtPointer = errorType - 14;
(errorLang=='EN')?errString=registrationBlank1EN+contactFrmFldsTxt[txtPointer]+registrationBlank2EN:errString=registrationBlank1GR+contactFrmFldsTxtGR[txtPointer]+registrationBlank2GR;
  popErrDiv(errString);
  return;
}

}

function isEmpty(aTextField) {
   if ((aTextField.value.length==0) ||
   (aTextField.value==null)) {
      return true;
   }
   else { return false; }
}

function popErrDiv(errMsg) {
  if (document.getElementById('nsErrorMsgBody')!=null) {
    errDiv = document.getElementById('nsErrorMsgBody');
    errDiv.innerHTML=errMsg;
    showDiv('nsErrorBgContainer');
  } else {
  	alert(errMsg);
  }
}

function contactForm(form,currentLanguage) {
  //alert(form.id);
  var x=14;
  for (i = 0; i < contactFrmFlds.length; i++){
    //alert(document.forms[form.name].elements[contactFrmFlds[i]].value);
    if (isEmpty(form.elements[contactFrmFlds[i]])) {
      alertUser(x, currentLanguage); return false; 
    }
    x++;
  }
  return true;
}

/* IMAGE MANAGEMENT JAVASCRIPT */

function MM_swapImgRestore() {
  	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() {
  	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];
			}
		}
	}
}

function MM_findObj(n, d) {
  	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() {
  	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 openPopup(theURL,winName,features)
{
    window.open(theURL,winName,features);
}

function openPreview(URLtoOpen,windowName,screenWidth, screenHeight) {
	var screenWidth;
	var screenHeight;

	if (navigator.appName == 'Microsoft Internet Explorer' && (navigator.platform.substring(0,3) == 'Win')) {
			var scw=screenWidth;
			var sch=screenHeight;
			var scl=(screen.width / 2) - (screenWidth / 2);
			var sct=(screen.height / 2) - (screenHeight / 2);
			window.open (URLtoOpen, windowName, "left=" + scl + ",top=" + sct + ",width=" + scw + ",height=" + sch + ',scrollbars=yes,status=no,resizable=yes');
		}
	else if (navigator.appName == 'Netscape' || navigator.platform == 'MacPPC') {
			var scw=screenWidth;
			var sch=screenHeight;
			var scl=(screen.width / 2) - (screenWidth / 2);
			var sct=(screen.height / 2) - (screenHeight / 2);
			window.open (URLtoOpen, windowName, "screenX=" + scl + ",screenY=" + sct + ",outerWidth=" + scw + ",outerHeight=" + sch + ',scrollbars=yes,status=no,resizable=yes');
		}
	else {
			var scw=screenWidth;
			var sch=screenHeight;
			var scl=(screen.width / 2) - (screenWidth / 2);
			var sct=(screen.height / 2) - (screenHeight / 2);
			window.open (URLtoOpen, windowName, "screenX=" + scl + ",screenY=" + sct + ",outerWidth=" + scw + ",outerHeight=" + sch + ',scrollbars=yes,status=no,resizable=yes');
		}
}


function openPopup(theURL,winName,features) {
	window.open(theURL,winName,features);
}

function show_msg(msg) { alert(msg); }

function validateForm() {
	missing_required = 0;

	for (i = 0; i < arguments.length; i++) {
		if(arguments[i] == '') {
			missing_required = 1;
		}
	}

	if(missing_required) {
		alert("A required form field is missing.");
		return false;
	} else {
		return true;
	}
}

function expCustomLink(myURL) {
	location.href = myURL;
}

function setStatus(message)
{
	window.status = message;
}

function setUrl(path)
{
	document.location.href = path;
}

var screenWidth;
var screenHeight;

function expArticleLink(sectionId, articleId) {

	location.href = '/index.php?section_id=' + sectionId + '&section_copy_id=' + articleId;
}

function expPopupWindow(url, widthVal, heightVal, resizableVal, scrollbarsVal, toolbarVal, locationVal, directoriesVal, statusVal, menubarVal, copyHistoryVal) {

	var attributes = "width="  	 	 + widthVal       +
				 	 ",height=" 	 + heightVal      +
				 	 ",resizable="  + resizableVal  +
				 	 ",scrollbars="  + scrollbarsVal  +
				 	 ",toolbar=" 	 + toolbarVal 	  +
				 	 ",location=" 	 + locationVal 	  +
				 	 ",directories=" + directoriesVal +
				 	 ",status=" 	 + statusVal 	  +
				 	 ",menubar=" 	 + menubarVal 	  +
				 	 ",copyhistory=" + copyHistoryVal;

	window.open(url, 'WindowName', attributes);
}

<!--
// callback pool needs global scope
var jsrsContextPoolSize = 0;
var jsrsContextMaxPool = 10;
var jsrsContextPool = new Array();
var jsrsBrowser = jsrsBrowserSniff();
var jsrsPOST = true;
var containerName;

// constructor for context object
function jsrsContextObj( contextID ){
  
  // properties
  this.id = contextID;
  this.busy = true;
  this.callback = null;
  this.container = contextCreateContainer( contextID );
  
  // methods
  this.GET = contextGET;
  this.POST = contextPOST;
  this.getPayload = contextGetPayload;
  this.setVisibility = contextSetVisibility;
}

//  method functions are not privately scoped 
//  because Netscape's debugger chokes on private functions
function contextCreateContainer( containerName ){
  // creates hidden container to receive server data 
  var container;
  switch( jsrsBrowser ) {
    case 'NS':
      container = new Layer(100);
      container.name = containerName;
      container.visibility = 'hidden';
      container.clip.width = 100;
      container.clip.height = 100;
      break;
    
    case 'IE':
      document.body.insertAdjacentHTML( "afterBegin", '<span id="SPAN' + containerName + '"></span>' );
      var span = document.all( "SPAN" + containerName );
      var html = '<iframe name="' + containerName + '" src="" charset="iso-8859-1"></iframe>';
      span.innerHTML = html;
      span.style.display = 'none';
      container = window.frames[ containerName ];
      break;
      
    case 'MOZ':  
      var span = document.createElement('SPAN');
      span.id = "SPAN" + containerName;
      document.body.appendChild( span );
      var iframe = document.createElement('IFRAME');
      iframe.name = containerName;
      iframe.id = containerName;
      span.appendChild( iframe );
      container = iframe;
      break;

    case 'OPR':  
      var span = document.createElement('SPAN');
      span.id = "SPAN" + containerName;
      document.body.appendChild( span );
      var iframe = document.createElement('IFRAME');
      iframe.name = containerName;
      iframe.id = containerName;
      span.appendChild( iframe );
      container = iframe;
      break;
  }
  return container;
}

function contextPOST( rsPage, func, parms ){
  var d = new Date();
  var unique = d.getTime() + '' + Math.floor(1000 * Math.random());
  var doc = (jsrsBrowser == "IE" ) ? this.container.document : this.container.contentDocument;
  
doc.open();
  doc.write('<html><head><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"></head><body>');
  doc.write('<form accept-charset="iso-8859-1" name="jsrsForm" method="post" target="" ');
  doc.write(' action="' + rsPage + '&U=' + unique + '">');
  doc.write('<input type="hidden" name="C" value="' + this.id + '">');

  // func and parms are optional
  if (func != null){
  doc.write('<input type="hidden" name="F" value="' + func + '">');

    if (parms != null){
      if (typeof(parms) == "string"){
        // single parameter
        doc.write( '<input type="hidden" name="P0" '
                 + 'value="[' + jsrsEscapeQQ(parms) + ']">');
      } else {
        // assume parms is array of strings
        for( var i=0; i < parms.length; i++ ){
          doc.write( '<input type="hidden" name="P' + i + '" '
                   + 'value="[' + jsrsEscapeQQ(parms[i]) + ']">');
        }
      } // parm type
    } // parms
  } // func

  doc.write('</form></body></html>');
  doc.close();
  doc.forms['jsrsForm'].submit();

}

function contextGET( rsPage, func, parms ){

  // build URL to call
  var URL = rsPage;

  // always send context
  URL += "?C=" + this.id;

  // func and parms are optional
  if (func != null){
    URL += "&F=" + escape(func);

    if (parms != null){
      if (typeof(parms) == "string"){
        // single parameter
        URL += "&P0=[" + escape(parms+'') + "]";
      } else {
        // assume parms is array of strings
        for( var i=0; i < parms.length; i++ ){
          URL += "&P" + i + "=[" + escape(parms[i]+'') + "]";
        }
      } // parm type
    } // parms
  } // func

  // unique string to defeat cache
  var d = new Date();
  URL += "&U=" + d.getTime();
 
  // make the call
  switch( jsrsBrowser ) {
    case 'NS':
      this.container.src = URL;
      break;
    case 'IE':
      this.container.document.location.replace(URL);
      break;
    case 'MOZ':
      this.container.src = '';
      this.container.src = URL; 
      break;
    case 'OPR':
      this.container.src = '';
      this.container.src = URL; 
      break;
  }  
  
}

function contextGetPayload(){
  switch( jsrsBrowser ) {
    case 'NS':
      return this.container.document.forms['jsrs_Form'].elements['jsrs_Payload'].value;
    case 'IE':
      return this.container.document.forms['jsrs_Form']['jsrs_Payload'].value;
    case 'MOZ':
      return window.frames[this.container.name].document.forms['jsrs_Form']['jsrs_Payload'].value; 
    case 'OPR':
      var textElement = window.frames[this.container.name].document.getElementById("jsrs_Payload");
      return textElement.value;
  }  
}

function contextSetVisibility( vis ){
  switch( jsrsBrowser ) {
    case 'NS':
      this.container.visibility = (vis)? 'show' : 'hidden';
      break;
    case 'IE':
      document.all("SPAN" + this.id ).style.display = (vis)? '' : 'none';
      break;
    case 'MOZ':
      document.getElementById("SPAN" + this.id).style.visibility = (vis)? '' : 'hidden';
    case 'OPR':
      document.getElementById("SPAN" + this.id).style.visibility = (vis)? '' : 'hidden';
      this.container.width = (vis)? 250 : 0;
      this.container.height = (vis)? 100 : 0;
      break;
  }  
}

// end of context constructor

function jsrsGetContextID(){
  var contextObj;
  for (var i = 1; i <= jsrsContextPoolSize; i++){
    contextObj = jsrsContextPool[ 'jsrs' + i ];
    if ( !contextObj.busy ){
      contextObj.busy = true;      
      return contextObj.id;
    }
  }
  // if we got here, there are no existing free contexts
  if ( jsrsContextPoolSize <= jsrsContextMaxPool ){
    // create new context
    var contextID = "jsrs" + (jsrsContextPoolSize + 1);
    jsrsContextPool[ contextID ] = new jsrsContextObj( contextID );
    jsrsContextPoolSize++;
    return contextID;
  } else {
    alert( "jsrs Error:  context pool full" );
    return null;
  }
}

function jsrsExecute( rspage, callback, func, parms, visibility ){
  // call a server routine from client code
  //
  // rspage      - href to asp file
  // callback    - function to call on return 
  //               or null if no return needed
  //               (passes returned string to callback)
  // func        - sub or function name  to call
  // parm        - string parameter to function
  //               or array of string parameters if more than one
  // visibility  - optional boolean to make container visible for debugging

  // get context
  var contextObj = jsrsContextPool[ jsrsGetContextID() ];
  contextObj.callback = callback;

  var vis = (visibility == null)? false : visibility;
  contextObj.setVisibility( vis );

  if ( jsrsPOST && ((jsrsBrowser == 'IE') || (jsrsBrowser == 'MOZ'))){
    contextObj.POST( rspage, func, parms );
  } else {
    contextObj.GET( rspage, func, parms );
  }
  
  return contextObj.id;
}

function jsrsLoaded( contextID ){
  // get context object and invoke callback
  var contextObj = jsrsContextPool[ contextID ];
  if( contextObj.callback != null){
    contextObj.callback( jsrsUnescape( contextObj.getPayload() ), contextID );
  }
  // clean up and return context to pool
  contextObj.callback = null;
  contextObj.busy = false;
}

function jsrsError( contextID, str ){
  alert( unescape(str) );
  jsrsContextPool[ contextID ].busy = false
}

function jsrsEscapeQQ( thing ){
  return thing.replace(/'"'/g, '\\"');
}

function jsrsUnescape( str ){
  // payload has slashes escaped with whacks
  return str.replace( /\\\//g, "/" );
}

function jsrsBrowserSniff(){
if (document.layers) { return "NS"; }
if (document.all) {
		// But is it really IE?
		// convert all characters to lowercase to simplify testing
		var agt=navigator.userAgent.toLowerCase();
		var is_opera = (agt.indexOf("opera") != -1);
		if(is_opera) {
			return "OPR";
		} else {
			return "IE";
		}
  }
  if (document.getElementById) return "MOZ";
  return "OTHER";
}

function jsrsArrayFromString( s, delim ){
  // rebuild an array returned from server as string
  // optional delimiter defaults to ~
  var d = (delim == null)? '~' : delim;
  return s.split(d);
}

function jsrsDebugInfo(){
  // use for debugging by attaching to f1 (works with IE)
  // with onHelp = "return jsrsDebugInfo();" in the body tag
  var doc = window.open().document;
  doc.open;
  doc.write( 'Pool Size: ' + jsrsContextPoolSize + '<br><font face="arial" size="2"><b>' );
  for( var i in jsrsContextPool ){
    var contextObj = jsrsContextPool[i];
    doc.write( '<hr>' + contextObj.id + ' : ' + (contextObj.busy ? 'busy' : 'available') + '<br>');
    doc.write( contextObj.container.document.location.pathname + '<br>');
    doc.write( contextObj.container.document.location.search + '<br>');
    doc.write( '<table border="1"><tr><td>' + contextObj.container.document.body.innerHTML + '</td></tr></table>' );
  }
  doc.write('</table>');
  doc.close();
  return false;
}
//-->

