/*
// *********************************************************************************************** //
// T7 | Version 10.0 | Web Content Management
// © Copyright David Tracz, Bitefish 
// All Rights Reserved, www.bitefish.com 
//
// Regular Updates: Please request code tie-ins from www.bitefish.com! 
// When updates occur, all modifications to this script will be lost! 
// *********************************************************************************************** //
*/


var gIE = (navigator.userAgent.indexOf('MSIE') >= 0) ? 1 : 0; 
var gFX = (navigator.userAgent.indexOf('Firefox') >= 0) ? 1 : 0; 
var gOP = (navigator.userAgent.indexOf('Opera') >= 0) ? 1 : 0; 
var gCH = (navigator.userAgent.indexOf('Chrome') >= 0) ? 1 : 0; 
var gSA = (navigator.userAgent.indexOf('Safari') >= 0) ? 1 : 0; 



var callCount = 0;

var is_ie = (navigator.userAgent.indexOf('MSIE') >= 0) ? 1 : 0; 
var is_ie5 = (navigator.appVersion.indexOf("MSIE 5.5")!=-1) ? 1 : 0; 

var runTimerActive = false;
var runTimer = null;

var blogEditor = "";
var dockEditor = "";
var menuWindow = "";

var scrollListFocus = "";
var scrollListSpeed = 10;

var mX = 0;
var mY = 0;

var windowWidth = 0;
var windowHeight = 0;

var followMouseID = "";
var followMousePID = 0;
var followMouseAddX = 0;
var followMouseAddY = 0;

var centerRefresh = "";

var postServerParameter = "";
var postServerCalling = "";
var postServerContainer = "";



function SetCenterRefresh(pWindow)
{
	centerRefresh = pWindow;	
}

function CheckCenterRefresh(pWindow)
{
	var rv = false;
	if (centerRefresh == pWindow)
	{
		centerRefresh = "";
		rv = true;
	}
	return rv;
}


function InitializePage(pScrollTo)
{
	if (pScrollTo > 0)
	{		
		window.scrollBy(0,pScrollTo);
	}
	
	getWindowSize();


	if (document.attachEvent)
	{
		document.attachEvent('DOMMouseScroll',ScrollWheel);	
		document.attachEvent('onmousewheel',ScrollWheel);	
		document.attachEvent('onmousemove',getMouseXY);	
		window.attachEvent('onresize',getWindowSize);	
	}
	else
	{
		document.addEventListener('DOMMouseScroll',ScrollWheel,false);	
		document.addEventListener('mousewheel',ScrollWheel,false);	
		document.addEventListener('mousemove',getMouseXY,false);	
		window.addEventListener('resize',getWindowSize,false);	
	}	
}


function getWindowSize()
{
	var pWidth = 630;
	var pHeight = 460;
	
	if (document.body && document.body.offsetWidth) 
	{
		pWidth = document.body.offsetWidth;
		pHeight = document.body.offsetHeight;
	}
	
	if (document.compatMode=='CSS1Compat' && document.documentElement && document.documentElement.offsetWidth ) 
	{
		pWidth = document.documentElement.offsetWidth;
		pHeight = document.documentElement.offsetHeight;
	}
	
	if (window.innerWidth && window.innerHeight) 
	{
		pWidth = window.innerWidth;
		pHeight = window.innerHeight;
	}
	
	windowWidth = pWidth;
	windowHeight = pHeight;		
	
	setHtml("ICW",windowWidth + "x" + windowHeight);
	
}


function getEventX(e)
{
	var pPos = 0;
	
  if (gIE) 
    pPos = event.clientX + document.body.scrollLeft;
  else 
    pPos = e.pageX;
    
  return pPos;
}


function getEventY(e)
{
	var pPos = 0;
	
  if (gIE) 
    pPos = event.clientY + document.body.scrollLeft;
  else 
    pPos = e.pageY;
    
  return pPos;
}



function getMouseXY(e) 
{
	var tempX = getEventX(e);
	var tempY = getEventY(e);
  
  if (tempX < 0)
  	tempX = 0;
  if (tempY < 0)
  	tempY = 0;
  
  mX = tempX;
  mY = tempY;
  
	setHtml("ICC",mX + "x" + mY);
	
	if (followMouseID != "")
	{
		var fmY = mY;
		var fmX = mX;
		
		if (followMouseAddY > 0)
			fmY += followMouseAddY;
			
		if (followMouseAddX > 0)
			fmX += followMouseAddX;
		
		document.getElementById(followMouseID).style.top = fmY + "px";	
		document.getElementById(followMouseID).style.left = fmX + "px";	

		setHtml("ICC",mX + "x" + mY + " | " + fmX + "x" + fmY);

	}
	
}


function followMouse(pId,pPID,pCss)
{
	SetCssClass(pId,pCss);	
	followMouseID = pId;
	followMousePID = pPID;
	followMouseAddX = 15;
	followMouseAddY = 15;
}

function followMouseDropZoneEnter(pId,pIdZone,pCss)
{
	if (followMouseID != "" && followMouseID != pId)
	{
		SetCssClass(pIdZone,pCss);	
	}
}


function followMouseDropZoneLeave(pId,pIdZone,pCss)
{
	SetCssClass(pIdZone,pCss);	
}


function followMouseDrop(pId,pMode,pIdBase)
{
	if (followMouseID != "" && followMouseID != pId)
	{
		var pSource = document.getElementById(followMouseID);
		var pElement = document.getElementById(pId);
		var pCode = getHtml(followMouseID);
	

		var pNew = document.createElement("div");
		pNew.id = followMouseID;
		pNew.innerHTML = pCode;		


		switch (pMode)
		{
			case "Before":
				pElement.parentNode.insertBefore(pNew,pElement);
				break;
				
			case "Insert":
				pElement.parentNode.insertBefore(pNew,pElement.nextSibling);
				break;	

			case "After":
				pElement.parentNode.insertBefore(pNew,pElement.nextSibling);
				break;	

			case "Under":
				pElement.parentNode.insertBefore(pNew,pElement.nextSibling);
				break;	
		}

		pSource.parentNode.removeChild(pSource);		

		CallExecuteServerDynamic(pIdBase,followMousePID);

		followMouseID = "";
		followMousePID = 0;
		followMouseAddX = 15;
		followMouseAddY = 15;		
	}
}



function dragStartElement(event,pId,pCss)
{
}

function dragMoveElement(event,pId,pCss)
{
}

function dragEndElement(event,pId,pCss)
{
}



function SetBlogEditor(pId)
{
	if (blogEditor != "" && blogEditor != pId)
		setHtml(blogEditor,"");	
		
	blogEditor = pId;
}


function ClearBlogEditor()
{
	if (blogEditor != "")
		setHtml(blogEditor,"");	
	blogEditor = "";
}



function SetDockEditor(pId)
{
	if (dockEditor != "" && dockEditor != pId)
		setHtml(dockEditor,"");	
		
	dockEditor = pId;
}


function ClearDockEditor()
{
	if (dockEditor != "")
		setHtml(dockEditor,"");	
	dockEditor = "";
}



function SetMenuWindow(pId)
{
	menuWindow = pId;
}


function ClearMenuWindow()
{
	if (menuWindow != "")
		HideDiv(menuWindow);	
	menuWindow = "";
}


function CallServerDynamic(pIdBase)
{
	var pCalling = getValue(pIdBase + "_Calling");
	var pContainer = getValue(pIdBase + "_Container");
	
	CallServer(pCalling,pContainer);
}


function CallServerLoading(pCalling,pContainer)
{
 	document.getElementById(pContainer).innerHTML = "<div class=\"intControlCenterLoading\"></div>";
	CallServer(pCalling,pContainer);
}

function CallServer(pCalling,pContainer)
{
	
  callCount++;
	var objXmlHttp = null;

  if (is_ie)
  {       
    var strObjName = "";
    
    if (is_ie5)
      strObjName = "Microsoft.XMLHTTP";
    else
      strObjName = "Msxml2.XMLHTTP";
           
    try
    { 
      objXmlHttp = new ActiveXObject(strObjName); 
      objXmlHttp.onreadystatechange = function()
      {
        if (objXmlHttp.readyState == 4 || objXmlHttp.readyState == "complete") 
        {
        	// Return //
        	document.getElementById(pContainer).innerHTML = objXmlHttp.responseText;
        }
        else
        {
        	// Loading //
        }
      }
      objXmlHttp.open('GET', pCalling, true); 
      objXmlHttp.send(null); 		 
    } 
    catch(e)
    { 
  //		alert('IE detected, but object could not be created. Verify that active scripting and activeX controls are enabled'); 
      return; 
    }    
  }
  else
  { 
    // Mozilla | Netscape | Safari | ... //
    objXmlHttp = new XMLHttpRequest(); 
    objXmlHttp.onload = function()
    {
      if (objXmlHttp.readyState == 4 || objXmlHttp.readyState == "complete") 
      {
       	// Return //
       	document.getElementById(pContainer).innerHTML = objXmlHttp.responseText;
      }
      else
      {
       	// Loading //
      }
    }
    
    objXmlHttp.onerror = function()
    {
      if (objXmlHttp.readyState == 4 || objXmlHttp.readyState == "complete") 
      {
       	// Return //
      }
      else
      {
       	// Loading //
      }
    }
                    
    objXmlHttp.open('GET', pCalling, true); 
    objXmlHttp.send(null); 		 
  }        
}




function CallServerExtended(pCalling,pContainer,pMode,pParA,pParB,pParC,pParD,pEvent)
{
  callCount++;
	var objXmlHttp = null;

  if (is_ie)
  {       
    var strObjName = "";
    
    if (is_ie5)
      strObjName = "Microsoft.XMLHTTP";
    else
      strObjName = "Msxml2.XMLHTTP";
           
    try
    { 
      objXmlHttp = new ActiveXObject(strObjName); 
      objXmlHttp.onreadystatechange = function()
      {
        if (objXmlHttp.readyState == 4 || objXmlHttp.readyState == "complete") 
        {
        	// Return //
        	document.getElementById(pContainer).innerHTML = objXmlHttp.responseText;
        	
        	switch (pMode)
        	{
        		case "Focus":
	        		document.getElementById(pParA).focus();
        			break;	
        		
        		case "ScrollLeft":
	        		document.getElementById(pParA).scrollLeft = 0;
        			break;
        			
        		case "ScrollLeft_AutoAdjustLeft":
	        		document.getElementById(pParA).scrollLeft = 0;
							PositionDiv(pParB,'auto_adjust_window_width',pParC,pParD,"",pEvent);
        			break;

        		case "AutoAdjustLeft":
							PositionDiv(pParA,'auto_adjust_window_width',pParB,pParC,"",pEvent);
        			break;
        			
        		case "ScrollTo_Position":
        			if (pParB > 0)
        				document.getElementById(pParA).scrollLeft = pParB;
        			break;

        		case "ScrollTo_Position_MarkMenu":
	       			if (pParB > 0)
	       				document.getElementById(pParA).scrollLeft = pParB;
	       				
	       			var pSelectIdList = getHtml(pParA + "_SelectIdList");
	       			ToggleCssList(pSelectIdList,pParC,'intControlCenterDockTemplateNavItemOn','intControlCenterDockTemplateNavItem');	
        			break;
        	}
        }
        else
        {
        	// Loading //
        }
      }
      objXmlHttp.open('GET', pCalling, true); 
      objXmlHttp.send(null); 		 
    } 
    catch(e)
    { 
  //		alert('IE detected, but object could not be created. Verify that active scripting and activeX controls are enabled'); 
      return; 
    }    
  }
  else
  { 
    // Mozilla | Netscape | Safari | ... //
    objXmlHttp = new XMLHttpRequest(); 
    objXmlHttp.onload = function()
    {
      if (objXmlHttp.readyState == 4 || objXmlHttp.readyState == "complete") 
      {
       	// Return //
       	document.getElementById(pContainer).innerHTML = objXmlHttp.responseText;
        	
       	switch (pMode)
       	{
       		case "Focus":
        		document.getElementById(pParA).focus();
       			break;	
        		
       		case "ScrollLeft":
        		document.getElementById(pParA).scrollLeft = 0;
       			break;
        			
       		case "ScrollLeft_AutoAdjustLeft":
        		document.getElementById(pParA).scrollLeft = 0;
						PositionDiv(pParB,'auto_adjust_window_width',pParC,pParD,"",pEvent);
       			break;

       		case "AutoAdjustLeft":
						PositionDiv(pParA,'auto_adjust_window_width',pParB,pParC,"",pEvent);
       			break;
       			
       		case "ScrollTo_Position":
       			if (pParB > 0)
       				document.getElementById(pParA).scrollLeft = pParB;
       			break;

       		case "ScrollTo_Position_MarkMenu":
       			if (pParB > 0)
       				document.getElementById(pParA).scrollLeft = pParB;
       				
       			var pSelectIdList = getHtml(pParA + "_SelectIdList");
       			ToggleCssList(pSelectIdList,pParC,'intControlCenterDockTemplateNavItemOn','intControlCenterDockTemplateNavItem');	
       			break;
       	}
      }
      else
      {
       	// Loading //
      }
    }
    
    objXmlHttp.onerror = function()
    {
      if (objXmlHttp.readyState == 4 || objXmlHttp.readyState == "complete") 
      {
       	// Return //
      }
      else
      {
       	// Loading //
      }
    }
                    
    objXmlHttp.open('GET', pCalling, true); 
    objXmlHttp.send(null); 		 
  }        
}



function CallExecuteServerDynamic(pIdBase,pAdd)
{
	var pCalling = getValue(pIdBase + "_Calling") + "" + pAdd;		
	CallExecuteServer(pCalling);
}

function CallExecuteServerWarning(pCalling,pWarning)
{
	if (window.confirm(pWarning) == true)
	{
		CallExecuteServer(pCalling);
	}
}


function CallExecuteServer(pCalling)
{
  callCount++;
	var objXmlHttp = null;
	var pPar = "";

  if (is_ie)
  {       
    var strObjName = "";
    
    if (is_ie5)
      strObjName = "Microsoft.XMLHTTP";
    else
      strObjName = "Msxml2.XMLHTTP";
           
    try
    { 
      objXmlHttp = new ActiveXObject(strObjName); 
      objXmlHttp.onreadystatechange = function()
      {
        if (objXmlHttp.readyState == 4 || objXmlHttp.readyState == "complete") 
        {
        	// Return | Parameter //
        	
        	// ReWriteDocumentTitle //
        	if (objXmlHttp.responseText.indexOf('ReWriteDocumentTitle|') >= 0)
        	{
        		pPar = objXmlHttp.responseText.replace("ReWriteDocumentTitle|","");
        		if (pPar != "")
         			document.title = pPar;
        	}
        	
        	// Debug //
        	if (objXmlHttp.responseText.indexOf('Debug|') >= 0)
        	{
        		pPar = objXmlHttp.responseText.replace("Debug|","");
        		if (pPar != "")
         			alert(pPar);
        	}
        	
        	// Return //
          switch (objXmlHttp.responseText)
          {
          	case "[ReDirect]":
          	case "Redirect":
          		Redirect("");
          		break;

          	case "RedirectHome":
          		Redirect("index.php");
          		break;      
          }
        }
        else
        {
        	// Loading //
        }
      }
      objXmlHttp.open('GET', pCalling, true); 
      objXmlHttp.send(null); 		 
    } 
    catch(e)
    { 
  //		alert('IE detected, but object could not be created. Verify that active scripting and activeX controls are enabled'); 
      return; 
    }    
  }
  else
  { 
    // Mozilla | Netscape | Safari | ... //
    objXmlHttp = new XMLHttpRequest(); 
    objXmlHttp.onload = function()
    {
      if (objXmlHttp.readyState == 4 || objXmlHttp.readyState == "complete") 
      {
       	// Return | Parameter //
       	
       	// ReWriteDocumentTitle //
       	if (objXmlHttp.responseText.indexOf('ReWriteDocumentTitle|') >= 0)
       	{
       		pPar = objXmlHttp.responseText.replace("ReWriteDocumentTitle|","");
       		if (pPar != "")
        		document.title = pPar;
       	}       	
       	
       	// Debug //
       	if (objXmlHttp.responseText.indexOf('Debug|') >= 0)
       	{
       		pPar = objXmlHttp.responseText.replace("Debug|","");
       		if (pPar != "")
        			alert(pPar);
       	}
      	
       	// Return //
				switch (objXmlHttp.responseText)
				{
         	case "[ReDirect]":
					case "Redirect":
						Redirect("");
						break;
					
					case "RedirectHome":
						Redirect("index.php");
						break;          		
				}
      }
      else
      {
       	// Loading //
      }
    }
    
    objXmlHttp.onerror = function()
    {
      if (objXmlHttp.readyState == 4 || objXmlHttp.readyState == "complete") 
      {
       	// Return //
      }
      else
      {
       	// Loading //
      }
    }
                    
    objXmlHttp.open('GET', pCalling, true); 
    objXmlHttp.send(null); 		 
  }        
}


function ReCallExecuteServerWarning(pCalling,pWarning,pReCalling,pReContainer)
{
	if (window.confirm(pWarning) == true)
	{
		ReCallExecuteServer(pCalling,pReCalling,pReContainer);
	}
}

//       ReCallExecuteServer(pCalling,pSearchIdBase,pSearchTerm)
//       ReCallExecuteServer(pCalling,pReDirect,pScrollTo)
function ReCallExecuteServer(pCalling,pReCalling,pReContainer)
{
  callCount++;
	var objXmlHttp = null;

  if (is_ie)
  {       
    var strObjName = "";
    
    if (is_ie5)
      strObjName = "Microsoft.XMLHTTP";
    else
      strObjName = "Msxml2.XMLHTTP";
           
    try
    { 
      objXmlHttp = new ActiveXObject(strObjName); 
      objXmlHttp.onreadystatechange = function()
      {
        if (objXmlHttp.readyState == 4 || objXmlHttp.readyState == "complete") 
        {
          if (objXmlHttp.responseText > 0)
        		CallServer(pReCalling + objXmlHttp.responseText,pReContainer);
					else
					{
						switch (objXmlHttp.responseText)
						{
							case "[ReCall]":
								CallServer(pReCalling,pReContainer);
								break;	

							case "[ReDirect]":
								RedirectToPosition(pReCalling,pReContainer);
								break;	
								
							case "[ReSearch]":
							
	         			// TA = TEXTAREA - URLS REQUIRE REGULAR TEXT SOURCES //
								pSearchCall = getValue(pReCalling + "_SearchCallTA") + "&t=" + pReContainer;
								pSearchLoader = getHtml(pReCalling + "_SearchLoader");
								CallServer(pSearchCall,pSearchLoader);
							
// 								pSearchCall = resolveAMP(getHtml(pReCalling + "_SearchCall")) + "&t=" + pReContainer;
// 								pSearchLoader = getHtml(pReCalling + "_SearchLoader");
// 								CallServer(pSearchCall,pSearchLoader);
								break;
						
							default:
								if (objXmlHttp.responseText != "")
									alert(objXmlHttp.responseText);
								break;						
						}
       		}
        }
        else
        {
        	// Loading //
        }
      }
      objXmlHttp.open('GET', pCalling, true); 
      objXmlHttp.send(null); 		 
    } 
    catch(e)
    { 
  //		alert('IE detected, but object could not be created. Verify that active scripting and activeX controls are enabled'); 
      return; 
    }    
  }
  else
  { 
    // Mozilla | Netscape | Safari | ... //
    objXmlHttp = new XMLHttpRequest(); 
    objXmlHttp.onload = function()
    {
      if (objXmlHttp.readyState == 4 || objXmlHttp.readyState == "complete") 
      {
      	if (objXmlHttp.responseText > 0)
       		CallServer(pReCalling + objXmlHttp.responseText,pReContainer);
				else
				{
					switch (objXmlHttp.responseText)
					{
						case "[ReCall]":
							CallServer(pReCalling,pReContainer);
							break;	

						case "[ReDirect]":
							RedirectToPosition(pReCalling,pReContainer);
							break;	
								
						case "[ReSearch]":
         			// TA = TEXTAREA - URLS REQUIRE REGULAR TEXT SOURCES //
							pSearchCall = getValue(pReCalling + "_SearchCallTA") + "&t=" + pReContainer;
							pSearchLoader = getHtml(pReCalling + "_SearchLoader");
							CallServer(pSearchCall,pSearchLoader);

// 							pSearchCall = getHtml(pReCalling + "_SearchCall") + "&t=" + pReContainer;
// 							pSearchLoader = getHtml(pReCalling + "_SearchLoader");
// 							CallServer(pSearchCall,pSearchLoader);
							break;
					
						default:
							if (objXmlHttp.responseText != "")
								alert(objXmlHttp.responseText);
							break;						
					}
      	}
      }
      else
      {
       	// Loading //
      }
    }
    
    objXmlHttp.onerror = function()
    {
      if (objXmlHttp.readyState == 4 || objXmlHttp.readyState == "complete") 
      {
       	// Return //
      }
      else
      {
       	// Loading //
      }
    }
                    
    objXmlHttp.open('GET', pCalling, true); 
    objXmlHttp.send(null); 		 
  }        
}


function CollectParameters(pFields)
{
  var pParameters = "";  
  
  var pFieldsArray = pFields.split(",");
  for (i = 0; i < pFieldsArray.length; i++)
  {
    if (pFieldsArray[i] != "")
    {
      if (pParameters != "")
        pParameters += "&";
      pParameters += pFieldsArray[i] + "=" + encodePLUS(encodeAMP(encodeURI(getValue(pFieldsArray[i]))));
    }
  }  
  
  //alert(pParameters);
  return pParameters;
}

function encodeAMP(pText)
{
  var rv = pText;

  rv = rv.replace(/&szlig;/gi,"[specs]");
  rv = rv.replace(/&uuml;/gi,"[lcu]");
  rv = rv.replace(/&Uuml;/gi,"[ucu]");
  rv = rv.replace(/&ouml;/gi,"[lco]");
  rv = rv.replace(/&Ouml;/gi,"[uco]");
  rv = rv.replace(/&auml;/gi,"[lca]");
  rv = rv.replace(/&Auml;/gi,"[uca]");

  rv = rv.replace(/&#/gi,"[sharp]");
  rv = rv.replace(/&amp;/gi,"[amp]");
  rv = rv.replace(/&/gi,"[amp]");

  return rv;
}

function resolveAMP(pText)
{
  var rv = pText;

	rv = rv.replace(/[amp]/gi,"&");
	rv = rv.replace(/[sharp]/gi,"&#");
 
  rv = rv.replace(/[specs]/gi,"&szlig;");
  rv = rv.replace(/[lcu]/gi,"&uuml;");
  rv = rv.replace(/[ucu]/gi,"&Uuml;");
  rv = rv.replace(/[lco]/gi,"&ouml;");
  rv = rv.replace(/[uco]/gi,"&Ouml;");
  rv = rv.replace(/[lca]/gi,"&auml;");
  rv = rv.replace(/[uca]/gi,"&Auml;");

  return rv;
}


function encodePLUS(pText)
{
  var rv = pText.replace("+","{plus}");
  return rv;
}

function PostServerSet(pPar,pCalling,pContainer)
{
	postServerParameter = pPar;
	postServerCalling = pCalling;
	postServerContainer = pContainer;	
}

function PostServer(pCalling,pId,pParameters)
{
  var success = 0;
  var reload = 0;
	var objXmlHttp = null;
	var pPar = "";
	var runLoading = false;
	var idLoading = pParameters; // Before Collection! //
	
	postServerParameter = ""; // Reset Parameter //
	postServerCalling = "";
	postServerContainer = "";


  if (pParameters != "")
  {
   	if (pId == "")
   	{
   		setHtml(idLoading + "_autoloader","<div class='intControlCenterLoadingCircleGreen'></div>");	
   		runLoading = true;
   	}

  	//pParameters = CollectParameters(pParameters);
  	pParameters = bt_parameter_collection(pParameters,true);
   	
    if (is_ie)
    {       
      var strObjName = (is_ie5) ? 'Microsoft.XMLHTTP' : 'Msxml2.XMLHTTP'; 
             
      try
      { 
        callCount++;
    	
        objXmlHttp = new ActiveXObject(strObjName); 

        if (objXmlHttp.overrideMimeType)
          objXmlHttp.overrideMimeType('text/html');
        
        
        objXmlHttp.onreadystatechange = function()
        {
          if (objXmlHttp.readyState == 4 || objXmlHttp.readyState == "complete") 
          {
	        	// ReWriteDocumentTitle //
	        	if (objXmlHttp.responseText.indexOf('ReWriteDocumentTitle|') >= 0)
	        	{
	        		pPar = objXmlHttp.responseText.replace("ReWriteDocumentTitle|","");
	        		if (pPar != "")
	         			document.title = pPar;
	        	}
          	
			      if (runLoading)
				   		setHtml(idLoading + "_autoloader","");	
	          	
	         	switch (postServerParameter)
	         	{
	         		case "ReSearch":
	         			// TA = TEXTAREA - URLS REQUIRE REGULAR TEXT SOURCES //
	 							pSearchCall = getValue(postServerCalling + "_SearchCallTA") + "&t=" + postServerContainer;
	 							pSearchLoader = getHtml(postServerCalling + "_SearchLoader");
	 							CallServer(pSearchCall,pSearchLoader);
	         			break;	
	         	}
          	          	
          	if (pId != "")
          	{
	          	if (pPar == "")
	          	{
			          switch (objXmlHttp.responseText)
			          {
			          	case "Completed":
			          		ShowDiv(pId + "Complete");
			          		HideDiv(pId + "Failed");
			          		HideDiv(pId + "Changed");
										setHtml(pId + "State","");
			          		break;
			
			          	case "Failed":
			          		HideDiv(pId + "Complete");
			          		ShowDiv(pId + "Failed");
			          		HideDiv(pId + "Changed");
			          		break;
			          		
			          	case "Reload":
			          		ShowDiv(pId + "Complete");
			          		HideDiv(pId + "Failed");
			          		HideDiv(pId + "Changed");
										setHtml(pId + "State","");
			          		Redirect("");
			          		break;
		          	
			          	default:
			          		if (objXmlHttp.responseText != "")
			          			alert(objXmlHttp.responseText);
			          		break;
			          }
			        }
			      }
			      
          }
        }
        objXmlHttp.open('POST', pCalling, true); 
        objXmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
        objXmlHttp.setRequestHeader("Content-length", pParameters.length);
        objXmlHttp.setRequestHeader("Connection", "close");
        objXmlHttp.send(pParameters);
      } 
      catch(e)
      { 
    //		alert('IE detected, but object could not be created. Verify that active scripting and activeX controls are enabled'); 
        return; 
      } 
    }
    else
    { 
    
      // Mozilla | Netscape | Safari | (opera?)
      objXmlHttp = new XMLHttpRequest(); 
      
      if (objXmlHttp.overrideMimeType)
        objXmlHttp.overrideMimeType('text/html');
      
      objXmlHttp.onreadystatechange = function()
      {
        // objXmlHttp.status == 200
        if (objXmlHttp.readyState == 4 || objXmlHttp.readyState == "complete") 
        {
        	
        	// ReWriteDocumentTitle //
        	if (objXmlHttp.responseText.indexOf('ReWriteDocumentTitle|') >= 0)
        	{
        		pPar = objXmlHttp.responseText.replace("ReWriteDocumentTitle|","");
        		if (pPar != "")
         			document.title = pPar;
        	}
         	
		      if (runLoading)
		      {
			   		setHtml(idLoading + "_autoloader","");	
         	}
         	
         	switch (postServerParameter)
         	{
         		case "ReSearch":
         			// TA = TEXTAREA - URLS REQUIRE REGULAR TEXT SOURCES //
 							pSearchCall = getValue(postServerCalling + "_SearchCallTA") + "&t=" + postServerContainer;
 							pSearchLoader = getHtml(postServerCalling + "_SearchLoader");
 							CallServer(pSearchCall,pSearchLoader);
         			break;	
         	}
         	
         	if (pId != "")
         	{
	         	if (pPar == "")
	         	{
		          switch (objXmlHttp.responseText)
		          {
		          	case "Completed":
		          		ShowDiv(pId + "Complete");
		          		HideDiv(pId + "Failed");
		          		HideDiv(pId + "Changed");
									setHtml(pId + "State","");
		          		break;
		
		          	case "Failed":
		          		HideDiv(pId + "Complete");
		          		ShowDiv(pId + "Failed");
		          		HideDiv(pId + "Changed");
		          		break;
			          		
		          	case "Reload":
		          		ShowDiv(pId + "Complete");
		          		HideDiv(pId + "Failed");
		          		HideDiv(pId + "Changed");
									setHtml(pId + "State","");
		          		Redirect("");
		          		break;
		          	
		          	default:
		          		if (objXmlHttp.responseText != "")
		          			alert(objXmlHttp.responseText);
		          		break;
		          }
		        }
		      }
        }
      }     
                      
      objXmlHttp.open('POST', pCalling, true); 
      objXmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
      objXmlHttp.setRequestHeader("Content-length", pParameters.length);
      objXmlHttp.setRequestHeader("Connection", "close");
      objXmlHttp.send(pParameters);
    }
    
  }
} // pId //

function ControlFormClear(pId)
{	
	setHtml(pId + "_SaveState","Changed");
	HideDiv(pId + "_SaveComplete");	
	HideDiv(pId + "_SaveFailed");
	ShowDiv(pId + "_SaveChanged");
}

function ControlFormCheck(pId,pContinueMessage)
{
	if (getHtml("fm" + pId + "_SaveState") == "Changed")
	{
		if (window.confirm(pContinueMessage) == true)
			return true;
		else
			return false;		
	}
	else
		return true;
}

function ControlFormNavigationCheck(pIdBase,pContinueMessage)
{
	var pNavStateID = getHtml(pIdBase + "_TemplateSlideNavigationState");
	var pNavState = getHtml("fm" + pNavStateID + "_SaveState");
	
	if (pNavState == "Changed")
	{
		if (window.confirm(pContinueMessage) == true)
			return true;
		else
			return false;		
	}
	else
		return true;
}



function SetBookmark()
{
	if(document.all)
		window.external.AddFavorite(location.href,document.title);
	else
	{
		if(window.sidebar)
			window.sidebar.addPanel(document.title,location.href,'');
	}
}

function SwitchCheckbox(pid)
{
	if (document.getElementById(pid).checked == true)
		document.getElementById(pid).checked = false;
	else
		document.getElementById(pid).checked = true;
}

function SwitchDiv(pid,pset)
{
	if (document.getElementById(pid).style.display == "block")
		document.getElementById(pid).style.display = "none";
	else
		document.getElementById(pid).style.display = "block";
		
	document.getElementById(pset).value = document.getElementById(pid).style.display;
}



function ToggleValue(pId,pValue,pA,pB)
{
	if (document.getElementById(pId).value == pValue)
		setValue(pId,pA);
	else
		setValue(pId,pB);
}


function ToggleImage(pCheckId,pId,pValue,pA,pB)
{
	if (document.getElementById(pCheckId).value == pValue)
		document.getElementById(pId).src = pA;
	else
		document.getElementById(pId).src = pB;	
}


function ToggleVisibility(pDiv)
{
	if (document.getElementById(pDiv).style.display == "block")
		document.getElementById(pDiv).style.display = "none";
	else
		document.getElementById(pDiv).style.display = "block";
}




function ToggleVisibilityList(pList,pSelected)
{
	var pListArray = pList.split(",");
	for(i = 0; i < pListArray.length; i++)
	{
		if (pListArray[i] != "")
		{
			if (pListArray[i] == pSelected)
				document.getElementById(pSelected).style.display = "block";
			else
				document.getElementById(pListArray[i]).style.display = "none";
		}
	}
}


function ToggleCss(pId,pOn,pOff)
{
	if (document.getElementById(pId).className == pOn)
		SetCssClass(pId,pOff);
	else
		SetCssClass(pId,pOn);
}

function ToggleCssList(pList,pSelected,pOn,pOff)
{
		
	var pListArray = pList.split(",");
	for(i = 0; i < pListArray.length; i++)
	{
		if (pListArray[i] != "")
		{
			if (pListArray[i] == pSelected)
				SetCssClass(pListArray[i],pOn);
			else
				SetCssClass(pListArray[i],pOff);
		}
	}
}


function ToggleCssListViaBase(pList,pBaseList,pSelected,pOn,pOff)
{	
	var pListArray = pList.split(",");
	var pBaseListArray = pBaseList.split(",");
	for(i = 0; i < pListArray.length; i++)
	{
		if (pListArray[i] != "")
		{
			if (pListArray[i] == pSelected)
				SetCssClass(pListArray[i],pBaseListArray[i] + pOn);
			else
				SetCssClass(pListArray[i],pBaseListArray[i] + pOff);
		}
	}
}



function ShowDiv(pId)
{
	if (pId != "")
	{
		if (document.getElementById(pId).style.display != "block")
			document.getElementById(pId).style.display = "block";
	}
}


  
function ShowDivRightHere(event,pId,pOverrideX,pOverrideY)
{
  var pX = event.clientX;
  var pY = event.clientY;
	
	if (pOverrideX > 0)
		pX = pOverrideX;

	if (pOverrideY > 0)
		pY = pOverrideY;
	
	document.getElementById(pId).style.top = pY + "px";	
	document.getElementById(pId).style.left = pX + "px";	
	document.getElementById(pId).style.display = "block";	
}

function HideDiv(pid)
{
	if (pid != "")
	{
		if (document.getElementById(pid).style.display != "none")
			document.getElementById(pid).style.display = "none";
	}
}

function HideDivList(pList)
{
	var pListArray = pList.split(",");
	for(i = 0; i < pListArray.length; i++)
	{
		if (pListArray[i] != "")
		{
			if (document.getElementById(pListArray[i]).style.display != "none")
				document.getElementById(pListArray[i]).style.display = "none";
		}
	}

}





function SwitchDivSimple(pid)
{
	if (document.getElementById(pid).style.display == "block" || 
			document.getElementById(pid).style.visibility == "visible")
	{		 
		document.getElementById(pid).style.visibility = "collapse";
		document.getElementById(pid).style.display = "none";
	}
	else
	{
		document.getElementById(pid).style.visibility = "visible";
		document.getElementById(pid).style.display = "block";
	}
}


function ConfirmLink(pmessage,purl)
{
	if (window.confirm(pmessage) == true)
	{
		window.location.href = purl;
	}
}

function ParentConfirmLink(pmessage,purl)
{
	if (window.confirm(pmessage) == true)
	{
		parent.location.href = purl;
	}
}

function ReloadLogin(pMode,pUrl)
{
	if (pMode == "1")
	{
		window.close();
		opener.focus();
		opener.location.href = pUrl;
	}
	else
	{
		window.location.href = pUrl;		
	}
}


function Redirect(pUrl)
{
	if (pUrl == "")
		pUrl = window.location.href;	
	
	window.location.href = pUrl;
}




function RedirectToPosition(pUrl,pScrollTo)
{
	if (pUrl == "")
		pUrl = window.location.href;	
	
	pUrl = pUrl.replace(/&scr=0/gi,"");	
	pUrl = pUrl.replace("&scr=" + pScrollTo,"");	
	
	if (window.pageYOffset > 0)
		pUrl = pUrl + "&scr=" + window.pageYOffset
	
	pUrl = pUrl.replace("/&","?");	
	
	window.location.href = pUrl;
}

function OpenGallerySlide(pKey,pKeyMax,pWebRoot,pId,pWidth,pHeight,pImagePath,pCloseLabel,pShadow,pBackLabel,pForwardLabel,pBarWidth)
{
	var sTop = 0;
	var sLeft = 0;
	var sWidth = pWidth;
	var sHeight = pHeight;
	var sPadding = 25;		
	var urlKey = 0;

	
	var urlBack = "";
	if (pKey > 0)
	{
		urlKey = (pKey - 1);
		urlBack = getValue(pId + "SU" + urlKey);
	}
	
	var urlForward = "";
	if (pKey < pKeyMax)
	{
		urlKey = (pKey + 1);
		urlForward = getValue(pId + "SU" + urlKey);
	}
	
	//z-index:;
	var iv = "<div style=\"position:absolute;top:" + sTop + "px;left:" + sLeft + "px;width:" + sWidth + "px;height:" + sHeight + "px;";
	iv += "padding:" + sPadding + "px;background-image:url(" + pWebRoot + "/image/Shadow" + pShadow + ".png);cursor:pointer;\">";
	
	iv += "<div style=\"position:relative;width:100%;height:100%;\">";
	
	
	if (urlBack != "")
	{
 		iv += "<div onmouseover=\"ShowDiv('" + pId + "Back')\" onmouseout=\"HideDiv('" + pId + "Back')\" onclick=\"" + urlBack + "\" title=\"" + pBackLabel + "\" ";
 		iv += " style=\"position:absolute;top:0px;left:0px;width:" + pBarWidth + "px;height:100%;\">";
 		iv += "<div id=\"" + pId + "Back\" style=\"display:none;width:" + pBarWidth + "px;height:100%;background-image:url(" + pWebRoot + "/image/Shadow32.png);\">";
 		iv += "<table style=\"width:100%;height:100%;\"><tr><td align=\"center\"><img src=\"" + pWebRoot + "/image/ShadowArrowLeft.png\" border=\"0\" alt=\"\" /></td></tr></table>";
 		iv += "</div></div>";	
	}
	
	if (urlForward != "")
	{
 		iv += "<div onmouseover=\"ShowDiv('" + pId + "Forward')\" onmouseout=\"HideDiv('" + pId + "Forward')\" onclick=\"" + urlForward + "\" title=\"" + pForwardLabel + "\" ";
 		iv += " style=\"position:absolute;top:0px;right:0px;width:" + pBarWidth + "px;height:100%;\">";
 		iv += "<div id=\"" + pId + "Forward\" style=\"display:none;width:" + pBarWidth + "px;height:100%;background-image:url(" + pWebRoot + "/image/Shadow32.png);\">";
 		iv += "<table style=\"width:100%;height:100%;\"><tr><td align=\"center\"><img src=\"" + pWebRoot + "/image/ShadowArrowRight.png\" border=\"0\" alt=\"\" /></td></tr></table>";
 		iv += "</div></div>";	
	}
	
	iv += "<div onclick=\"setHtml('" + pId + "','');\" title=\"" + pCloseLabel + "\"><img src=\"" + pImagePath + "\" border=\"0\" alt=\"\" /></div>";
	
	iv += "</div>";
	iv += "</div>";
	
	setHtml(pId,iv);
}



function OpenSlide(pWebRoot,pId,pWidth,pHeight,pImagePath,pCloseLabel,pShadow)
{
	var sTop = 0;
	var sLeft = 0;
	var sWidth = pWidth;
	var sHeight = pHeight;
	var sPadding = 25;		
	
	
	//z-index:;
	var iv = "<div style=\"position:absolute;top:" + sTop + "px;left:" + sLeft + "px;width:" + sWidth + "px;height:" + sHeight + "px;";
	iv += "padding:" + sPadding + "px;background-image:url(" + pWebRoot + "/image/Shadow" + pShadow + ".png);cursor:pointer;\">";
	
	iv += "<div style=\"position:relative;width:100%;height:100%;\">";
	
	iv += "<div onclick=\"setHtml('" + pId + "','');\" title=\"" + pCloseLabel + "\"><img src=\"" + pImagePath + "\" width=\"" + sWidth + "\" height=\"" + sHeight + "\" border=\"0\" alt=\"\" /></div>";
	
	iv += "</div>";
	iv += "</div>";
	
	setHtml(pId,iv);
}


function OpenDialog(purl,pname,pwidth,pheight)
{
	psize = "";
	if (pwidth > 0 && pheight > 0)
	{
		if (gIE)
		{
			pwidth += 24;
			pheight += 20;
		}
		psize = "width="+ pwidth +",height="+ pheight +",";
	}
	dialog = window.open(purl,pname,psize + "resizable=yes,scrollbars=yes,status=no,location=no,toolbar=no,menubar=no",true);
	
	wScreenX = ((screen.width-(pwidth*1))/2);
	wScreenY = ((screen.height-(pheight*1))/2);
	
// 	if (navigator.appName != "Microsoft Internet Explorer")
		dialog.moveTo(wScreenX,wScreenY);
	dialog.focus();
}



function PositionDiv(pId,pPosition,pParA,pParB,pParC,pEvent)
{
	var wPos = 0;
	var pTopPosition = 0;
	var pOverFlow = 0;
	var pTop = 0;
	var pLeft = 0;
	var pRight = 0;	
	var pWindowWidth = 800;
	var pWindowHeight = 600;
	
	if (document.body && document.body.offsetWidth) 
	{
		pWindowWidth = document.body.offsetWidth;
	 	pWindowHeight = document.body.offsetHeight;
	}
	
	if (document.compatMode == "CSS1Compat" && document.documentElement && document.documentElement.offsetWidth) 
	{
		pWindowWidth = document.documentElement.offsetWidth;
		pWindowHeight = document.documentElement.offsetHeight;
	}
	if (window.innerWidth && window.innerHeight) 
	{
		pWindowWidth = window.innerWidth;
		pWindowHeight = window.innerHeight;
	}
	
	
	switch (pPosition)
	{
		case "center":
			wPos = ((pWindowWidth - pParA) / 2);
			document.getElementById(pId).style.left = wPos + "px";
			break;
			
		case "compensate_top_offset":
			pTopPosition = (document.getElementById(pId).style.top.replace("px","") * 1);			
 			pTopPosition += window.pageYOffset;
			document.getElementById(pId).style.top = pTopPosition + "px";
			break;
			
		case "auto_adjust_window_width":
		
// 			alert(pParA);
// 			alert(pParB);
		
			pLeft = getEventX(pEvent);		
			pRight = (pLeft + pParA);
			
			if (pRight > pWindowWidth)
			{
				pOverFlow = (pWindowWidth - pRight);
				pOverFlow = (pOverFlow - 15);
				document.getElementById(pId).style.left = pOverFlow + "px";
			}
			else
			{
				document.getElementById(pId).style.left = pParB + "px";
			}
			
			break;
	}	
}



function SlideDiv(pId,pMode,pEndPosition)
{
	var pTopPosition = (document.getElementById(pId).style.top.replace("px","") * 1);
	var pLeftPosition = (document.getElementById(pId).style.left.replace("px","") * 1);

	if (gFX == 1)
	{
		pSpeed = 1;
		pRunInterval = 1;
	}
	else
	{
		if (gIE == 1)
		{
			pSpeed = 3;
			pRunInterval = 1;		
		}
		else
		{
			if (gCH == 1)
			{
				pSpeed = 1;
				pRunInterval = 1;		
			}
			else
			{
				pSpeed = 2;
				pRunInterval = 2;		
			}
		}
	}
	
	switch (pMode)
	{
		
		case "up": 	
			pTopPosition -= pSpeed;
			if (pTopPosition >= pEndPosition)
			{
				document.getElementById(pId).style.top = pTopPosition + "px";
				runTimer = setTimeout((function(){SlideDiv(pId,pMode,pEndPosition);}),pRunInterval);
				runTimerActive = true;
			}
			else
			{
				clearTimeout(runTimer);
				runTimerActive = false;
			}
			break;
		
		case "down": 	
			pTopPosition += pSpeed;
			if (pTopPosition <= pEndPosition)
			{
				document.getElementById(pId).style.top = pTopPosition + "px";
				runTimer = setTimeout((function(){SlideDiv(pId,pMode,pEndPosition);}),pRunInterval);
				runTimerActive = true;
			}
			else
			{
				clearTimeout(runTimer);
				runTimerActive = false;
			}
			break;

		case "left": 	
			pLeftPosition -= pSpeed;
			if (pLeftPosition >= pEndPosition)
			{
				document.getElementById(pId).style.left = pLeftPosition + "px";
				runTimer = setTimeout((function(){SlideDiv(pId,pMode,pEndPosition);}),pRunInterval);
				runTimerActive = true;
			}
			else
			{
				clearTimeout(runTimer);
				runTimerActive = false;
			}
			break;
			
		case "right": 	
			pLeftPosition += pSpeed;
			if (pLeftPosition <= pEndPosition)
			{
				document.getElementById(pId).style.left = pLeftPosition + "px";
				runTimer = setTimeout((function(){SlideDiv(pId,pMode,pEndPosition);}),pRunInterval);
				runTimerActive = true;
			}
			else
			{
				clearTimeout(runTimer);
				runTimerActive = false;
			}
			break;
			
	}	

}


function OpenWindow(purl,pname)
{
	window.open(purl,pname,"",true);
}

function OpenDialogAP(purl,pname,pwidth,pheight,pX,pY)
{
	psize = "";
	if (pwidth > 0 && pheight > 0)
	{
		if (gIE)
		{
			pwidth += 24;
			pheight += 20;
		}
		psize = "width="+ pwidth +",height="+ pheight +",";
	}
	
		
	dialog = window.open(purl,pname,psize + "resizable=yes,scrollbars=yes,status=no,location=no,toolbar=no,menubar=no",true);
	dialog.moveTo(pX,pY);
	dialog.focus();
}



function FormSetField(pid,pvalue)
{
	document.getElementById(pid).value = pvalue;
 	FormSubmit();
}

function FormSubmit()
{
	FormSubmitByIndex(0);
}


function ConfirmSubmit(pmessage,pIndex,pField,pSet)
{
	var pContinue = false;
	
	if (pmessage == "")
		pContinue = true;
	else
		pContinue = window.confirm(pmessage);	
	
	if (pContinue == true)
	{
		if (pField != "")
			SetField(pField,pSet);
			
		FormSubmitByIndex(pIndex);
	}
}


function FormSubmitByIndex(pIndex)
{
	document.forms[pIndex].submit();
}

function ReloadFrame(pid)
{
	document.getElementById(pid).location.reload(true);
}

function SetField(pid,pvalue)
{
	document.getElementById(pid).value = pvalue;
}

function GetField(pid)
{
	return document.getElementById(pid).value;
}


function SwitchUri(pValue,pPrimaryUri,pSecondaryUri)
{
	if (pValue != "")
		return pPrimaryUri
	else
		return pSecondaryUri
}




function SetCss(pid,pCssText)
{
	document.getElementById(pid).style.cssText = pCssText;
}



function SetCssClass(pid,pCssClass)
{
	document.getElementById(pid).className  = pCssClass;
}
 

function SetCssClassList(pList,pCssClass)
{
	var pListArray = pList.split(",");
	for(i = 0; i < pListArray.length; i++)
	{
		if (pListArray[i] != "")
			SetCssClass(pListArray[i],pCssClass);
	}

}

function Chie(pId,pAction,pPar,pValue,pAdditional)
{
	var pIE = (navigator.userAgent.indexOf('MSIE') >= 0) ? 1 : 0; 
	if (pIE)
		document[pId].jCall(pAction,pPar,pValue,pAdditional);
	else
		document.embeds[pId].jCall(pAction,pPar,pValue,pAdditional);
}



function GoTo(pUrl)
{
	window.location.href = pUrl;	
}

function FrameGoTo(pFrame,pUrl)
{
	window.frames[pFrame].location = pUrl;	
}

function SetImage(pPath,pId,pName)
{
	document.getElementById(pId).src = pPath + "/" + pName;
}

function MConcat(pA,pB,pQuery)
{	
	var pC = "@";
	document.location = "mailto:" + pA + pC + pB + pQuery;	
}



function getHtml(pId)
{
  var rv = "";
  
  try
  { 
    rv = document.getElementById(pId).innerHTML;
  } 
  catch(e)
  { 
  }   
  
  return rv;
}

function setHtml(pId,pValue)
{
  document.getElementById(pId).innerHTML = pValue;
}




function getValue(pId)
{
  var rv = "";
  
  try
  { 
    rv = document.getElementById(pId).value;
  } 
  catch(e)
  { 
  }   
  
  return rv;
}

function setValue(pId,pValue)
{
  document.getElementById(pId).value = pValue;
}

function addToValue(pMode,pId,pAdd)
{
	var sv = 0;
	if (pMode == "Value")
	{
		sv = (getValue(pId) + pAdd);
		setValue(pId,sv);
	}
	else
	{
		sv = ((getHtml(pId) * 1) + pAdd);
		setHtml(pId,sv);
	}	
}


function removeFromValue(pMode,pId,pRemove,pMinValue)
{
	var sv = 0;	
	if (pMode == "Value")
	{
		sv = getValue(pId);	
		if (pMinValue < sv)
			sv = (sv - pRemove);
		setValue(pId,sv);
	}
	else
	{
		sv = (getHtml(pId) * 1);
		if (pMinValue < sv)
			sv = (sv - pRemove);
		setHtml(pId,sv);
	}	
}

function setFocus(pId)
{
  try
  { 
	  document.getElementById(pId).focus();
	}
  catch(e)
  { 
  }   
}


function resizeIFrame()
{
	
}


function CaptureEvent(e,pEvent)
{
	var rv = false;
	//onkeypress="CaptureEvent(event,'OnEnter');" 

  var code = "";
  if (e && e.which)
  {
    code = e.which;    
  }
  else if (window.event)
  {
    e = window.event;
    code = e.keyCode;
  }
  
	// OnEnter //
  if (pEvent == "OnEnter" && code == 13)
  	rv = true;
	
	return rv;
}






function ScrollWheel(pEvent)
{
	if (scrollListFocus != "")
	{
		var pPosition = document.getElementById(scrollListFocus).scrollTop;
		
		var pPitch = 0;
		if ("wheelDelta" in pEvent) 
		  pPitch = pEvent.wheelDelta;
	  else
	  	pPitch = (pEvent.detail); // -40 * 
		
		var pDirection = "up";
		if (pPitch < 0)
		{
			pDirection = "down";
			pPitch = (pPitch * -1)
		}

		pPitch += scrollListSpeed;

		switch (pDirection)
		{
			case "up":
				pPosition += pPitch;
				break;	

			case "down":
				pPosition -= pPitch;
				break;	
		}
		
		if (pPosition >= 0)
			document.getElementById(scrollListFocus).scrollTop = pPosition;
	}
}


function ScrollTo(pid)
{
	document.getElementById(pid).scrollIntoView(true);
}


function ScrollDivSwitchMode(pSwitchMode,pId,pSpeed,pPreset,pRunInterval,pLimit)
{
	var pMode = "";
	switch (pSwitchMode)
	{
		case "run-left|run-right":
			pPosition = document.getElementById(pId).scrollLeft;	
			
			pMode = "run-right";
			if (pPosition > pLimit)	
				pMode = "run-left";			
		
			ScrollDiv(pId,pMode,pSpeed,pPreset,pRunInterval,pLimit)
			break;	

		case "left|right":
			pPosition = document.getElementById(pId).scrollLeft;	
			
			pMode = "right";
			if (pPosition > pLimit)	
				pMode = "left";			
		
			ScrollDiv(pId,pMode,pSpeed,pPreset,pRunInterval,pLimit)
			break;	

	}
}


function ScrollDiv(pId,pMode,pSpeed,pPreset,pRunInterval,pLimit)
{
	var pPosition = 0;
	var clearRunTimer = false;


	switch (pMode)
	{
		case "up": 
		case "down":	
		case "run-up": 
		case "run-down":	
		
			if (runTimerActive)
			{
				clearTimeout(runTimer);
				runTimerActive = false;
			}
		
			pPosition = document.getElementById(pId).scrollTop;		
			if (pPreset > 0)
				pPosition = pPreset;		
			break;

		case "continue-run-up": 
		case "continue-run-down": 
			pPosition = document.getElementById(pId).scrollTop;		
			break;

		case "left":	
		case "right":	
		case "run-left":	
		case "run-right":	

			if (runTimerActive)
			{
				clearTimeout(runTimer);
				runTimerActive = false;
			}
		
			pPosition = document.getElementById(pId).scrollLeft;		
			if (pPreset > 0)
				pPosition = pPreset;		
			break;
			
		case "continue-run-left": 
		case "continue-run-right": 
			pPosition = document.getElementById(pId).scrollLeft;		
			break;
			
		case "top":	
		case "bottom":	
		case "cancel":	
			break;
			
	}
		
	switch (pMode)
	{
		case "up": 
			pPosition -= pSpeed;
			document.getElementById(pId).scrollTop = pPosition;
			break;
			
		case "down":	
			pPosition += pSpeed;
			document.getElementById(pId).scrollTop = pPosition;
			break;

		case "run-up": 
		case "continue-run-up": 
			run = false;
			if (runTimerActive == false || pMode == "continue-run-up")
				run = true;			

			if (run)
			{
				pPosition -= pSpeed;
				document.getElementById(pId).scrollTop = pPosition;
				runTimer = setTimeout("ScrollDiv('"+ pId +"','continue-run-up',"+ pSpeed +","+ pPreset +","+ pRunInterval +","+ pLimit +")",pRunInterval);
				runTimerActive = true;
			}
			break;
			
		case "run-down":	
		case "continue-run-down": 
			run = false;
			if (runTimerActive == false || pMode == "continue-run-down")
				run = true;

			if (run)
			{
				pPosition += pSpeed;
				document.getElementById(pId).scrollTop = pPosition; 
				runTimer = setTimeout("ScrollDiv('"+ pId +"','continue-run-down',"+ pSpeed +","+ pPreset +","+ pRunInterval +","+ pLimit +")",pRunInterval);
				runTimerActive = true;
			}
			break;

		case "left": 
			pPosition -= pSpeed;
			document.getElementById(pId).scrollLeft = pPosition;
			break;
			
		case "right":	
			pPosition += pSpeed;
			document.getElementById(pId).scrollLeft = pPosition;
			break;

		case "run-left":	
		case "continue-run-left": 

			run = false;
			if (runTimerActive == false || pMode == "continue-run-left")
				run = true;

//			pPosition = (pPosition - pSpeed);
			pPosition -= pSpeed;

			if (run && pLimit != "")
			{
				if (pPosition < pLimit)
				{
					run = false;
					clearRunTimer = true;
					document.getElementById(pId).scrollLeft = pLimit; 
				}
			}

			if (run)
			{
				document.getElementById(pId).scrollLeft = pPosition; 
				runTimer = setTimeout((function(){ScrollDiv(pId,"continue-run-left",pSpeed,pPreset,pRunInterval,pLimit);}),pRunInterval);
				runTimerActive = true;
			}
			break;
			
		case "run-right":	
		case "continue-run-right": 
		
			run = false;
			if (runTimerActive == false || pMode == "continue-run-right")
				run = true;

			pPosition += pSpeed;
				
			if (run && pLimit != "")
			{
				if (pPosition > pLimit)
				{
					run = false;
					clearRunTimer = true;
					document.getElementById(pId).scrollLeft = pLimit; 
				}
			}

			if (run)
			{
				document.getElementById(pId).scrollLeft = pPosition; 
				runTimer = setTimeout((function(){ScrollDiv(pId,"continue-run-right",pSpeed,pPreset,pRunInterval,pLimit);}),pRunInterval);
				runTimerActive = true;
			}
			break;
			
		case "top":	
			if (runTimerActive)
			{
				clearTimeout(runTimer);
				runTimerActive = false;
			}

			pPosition = 0; 
			document.getElementById(pId).scrollTop = pPosition;
			break;
			
		case "bottom":	
			if (runTimerActive)
			{
				clearTimeout(runTimer);
				runTimerActive = false;
			}

			pPosition = document.getElementById(id).scrollHeight;
			document.getElementById(pId).scrollTop = pPosition;
			break;
			
		case "horizontal-jump":	
			if (runTimerActive)
			{
				clearTimeout(runTimer);
				runTimerActive = false;
			}

			document.getElementById(pId).scrollLeft = pLimit;
			break;

		case "vertical-jump":	
			if (runTimerActive)
			{
				clearTimeout(runTimer);
				runTimerActive = false;
			}

			document.getElementById(pId).scrollTop = pLimit;
			break;

		case "cancel":	
			if (runTimerActive)
			{
				clearTimeout(runTimer);
				runTimerActive = false;
			}
			break;
			
	}
	
	if (clearRunTimer)
	{
		clearTimeout(runTimer);
		runTimerActive = false;
	}
	
	
}



function SyncField(pFmSource,pFmTarget,pSeparator,pField)
{
	var value = getValue(pFmSource + pSeparator + pField);
	setValue(pFmTarget + pSeparator + pField, value);
}


function SyncCheckField(pFmSource,pFmTarget,pSeparator,pField)
{
	var sourceField = pFmSource + pSeparator + pField;
	var targetField = pFmTarget + pSeparator + pField
	
	var value = getValue(sourceField);
	
	setValue(targetField, value);

	if (value == 1)
		SetImage("image",targetField + "_Icon","iNarrowChecked.gif");
	else
		SetImage("image",targetField + "_Icon","iNarrowUnChecked.gif");
}


function SyncSelectField(pFmSource,pFmTarget,pSeparator,pField)
{
	var sourceField = pFmSource + pSeparator + pField;
	var targetField = pFmTarget + pSeparator + pField

	document.getElementById(targetField).selectedIndex = document.getElementById(sourceField).selectedIndex;
}

