//  ---------------
//  Document:  global.js
//  Project:   MyShare global java script.
//  Notes:	  This page is used as the global script page of the myshare website.  
//            Any scripting  code that exitst here, will run on every page.
//  
//  Author:	  Jam Williams, 21st September 2003, hotfridge@hotmail.com, 0425-737-907
//  --------------- 

//Default default and window status texts.
window_status_text = 'MYSHARE - Call 1300 653 795';
window.defaultStatus = 'MYSHARE - Making a world of difference';

//This function disables the functionality of the right mouse button.
//Some sort of protection against users hacking code.
function disable_Right_Click(right_mouse_button)
  {
   if (!document.rightClickDisabled)
     {
      if(document.layers) 
        {
         document.captureEvents(Event.MOUSEDOWN);
         document.onmousedown = disable_Right_Click;
        }
      else
	{
	 document.oncontextmenu = disable_Right_Click;
	}
		
    return document.rightClickDisabled = true;
  }

  if (document.layers || (document.getElementById && !document.all))
    {
     if (right_mouse_button.which == 2 || right_mouse_button.which == 3)
       {
        alert('Have you ever thought of supporting your cause?\n\nWhy not make a difference?\n' + window.defaultStatus + '...');
        return false;
       }
    }
  else
    {
     alert('Have you ever thought of supporting your cause?\n\nWhy not make a difference?\n' + window.defaultStatus + '...');
     return false;
    }
  }


//Function that fades objects, such as graphics or text.
Fade_Objects = new Object();
Fade_Timers = new Object();

function fader(object, destination_transparency, rate, delta)
  {
   if (!document.all)
     return;
    
   if (object != "[object]")
     {
      setTimeout("fader(" + object + "," + destination_transparency + "," + rate + "," + delta + ")", 0);
      return;
     }
        
   // Internet Explorer compatible.
   else if (object.filters)  
     {
      clearTimeout(Fade_Timers[object.sourceIndex]);
      diff = destination_transparency - object.filters.alpha.opacity;
      direction = 1;
  
      if (object.filters.alpha.opacity > destination_transparency)
        direction = -1;
     
      delta = Math.min(direction * diff, delta);
      object.filters.alpha.opacity += direction * delta;
     }

   //Netscape compatible.
   if (object.style.MozOpacity)
     {
      clearTimeout(Fade_Timers[object.sourceIndex]);
      diff = destination_transparency - object.style.MozOpacity;
      direction = 1;
  
      if (object.style.MozOpacity > destination_transparency)
        direction = -1;
     
      delta = Math.min(direction * diff, delta);
      object.style.MozOpacity += direction * delta;
     }
     
   if ((object.filters.alpha.opacity != destination_transparency) || (object.style.MozOpacity != destination_transparency))
     {
      Fade_Objects[object.sourceIndex] = object;
      Fade_Timers[object.sourceIndex] = setTimeout("fader(Fade_Objects[" + object.sourceIndex + "], " + destination_transparency + "," + rate + "," + delta + ")", rate);
     }
  }


//This function initializes and configures scroller for startup.
function initializeScroller()
    {
	 objData = document.all ? document.all.datacontainer : document.getElementById("datacontainer");
	 objData.style.top = 0;
	 objLength = objData.offsetHeight;
	 scrollStart();
    }


//This function starts the scroller.
  function scrollStart()
    {
	 if (objLength > intFrameHeight) 
	   {
	    intNewTop = objData.style.top=parseInt(objData.style.top) - intScrollSpeed;
		
		if (strScrollDirection == 'UP')
		  {
		   if (intNewTop < 0)
		     {
			  objData.style.top = parseInt(intNewTop);
			 }
		   else
		     {
			  objData.style.top = 0;
			 }
		   }
		else if (strScrollDirection == 'DOWN')
		  {
		   if (intNewTop >- (objLength - intFrameHeight))
		     {
			  objData.style.top = parseInt(intNewTop);
			 }
		   else
		     {
			  objData.style.top =- (objLength - intFrameHeight);
			 }
		  }
	   }
	   
   setTimeout("scrollStart()", 50);
  }


//Function informs customers of final signup proceedings.
function telarus_signup()
  {
   //Submit document.
   //alert('Under Development!\n\nNow send data ... \n\nDealer Code: "<%=signupVariables.Item("Dealer_Code")%>"\nCause: "<%=signupVariables.Item("Myshare_Cause")%>"\nHandset: "<%=signupVariables.Item("Myshare_Handset")%>"\n\nto RSLCOM MOBILE application page...');
   alert('Thank you for your expression of interest.\n\nCurrently, we are unable to process your request, as we are undergoing fundamental changes. For the moment, please download and complete the Application form, then return it to Myshare. Alternatively, return fax to 03 9769 6759 or mail to P.O. Box 604, Frankston, Victoria, 3199.\n\nFurther queries, please contact MYSHARE on 1300 6553 795.\nClick \"OK\" to commence downloading your application form.');
   document.location = 'index.asp';
   window.open('/pdf/telarus_application.pdf');
  }	 
  
  
//Run the function.  
  disable_Right_Click();
  //window.onload = initializeScroller;