function change_opacity(sObject, sOpacity){
	sObject.style.filter = "alpha(opacity="+Math.round(sOpacity)+")"; // IE/
	sObject.style.KHTMLOpacity = sOpacity/100;                        // safari<1.2, Konqueror
	sObject.style.MozOpacity = sOpacity/100;                          // Older Mozilla and Firefox
	sObject.style.opacity = sOpacity/100;                             // Safari 1.2, newer Firefox and Mozilla, CSS3   
}

function findPosX(obj) {
// returns the x position of an object

var curleft = 0;
if(obj.offsetParent)
  while(1)
  {
    curleft += obj.offsetLeft;
    if(!obj.offsetParent)
    break;
    obj = obj.offsetParent;
  }
else if(obj.x)
  curleft += obj.x;
return curleft;
}

function findPosY(obj) {
// returns the y position of an object

var curtop = 0;
if(obj.offsetParent)
  while(1)
  {
    curtop += obj.offsetTop;
    if(!obj.offsetParent)
    break;
    obj = obj.offsetParent;
  }
else if(obj.y)
  curtop += obj.y;
return curtop;
}   

function newImage(arg) {
	if (document.images) {
		rslt = new Image();
		rslt.src = arg;
		return rslt;
	}
}

function stretch_to_page(objDivToStrech){
	var arrayPageSize = getPageSize();
	objDivToStrech.style.width  = arrayPageSize[0];
	objDivToStrech.style.height = arrayPageSize[1];
}

function getPageSize(){
	var xScroll, yScroll;
	
	if (window.innerHeight && window.scrollMaxY) {	
		xScroll = window.innerWidth + window.scrollMaxX;
		yScroll = window.innerHeight + window.scrollMaxY;
	} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
		xScroll = document.body.scrollWidth;
		yScroll = document.body.scrollHeight;
	} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
		xScroll = document.body.offsetWidth;
		yScroll = document.body.offsetHeight;
	}
	
	var windowWidth, windowHeight;

	if (self.innerHeight) {	// all except Explorer
		if(document.documentElement.clientWidth){
			windowWidth = document.documentElement.clientWidth; 
		} else {
			windowWidth = self.innerWidth;
		}
		windowHeight = self.innerHeight;
	} else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
		windowWidth = document.documentElement.clientWidth;
		windowHeight = document.documentElement.clientHeight;
	} else if (document.body) { // other Explorers
		windowWidth = document.body.clientWidth;
		windowHeight = document.body.clientHeight;
	}	
	
	// for small pages with total height less then height of the viewport
	if(yScroll < windowHeight){
		pageHeight = windowHeight;
	} else { 
		pageHeight = yScroll;
	}

	// for small pages with total width less then width of the viewport
	if(xScroll < windowWidth){	
		pageWidth = xScroll;		
	} else {
		pageWidth = windowWidth;
	}

	arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight) 
	return arrayPageSize;
}

function getPageScroll(){

	var xScroll, yScroll;

	if (self.pageYOffset) {
		yScroll = self.pageYOffset;
		xScroll = self.pageXOffset;
	} else if (document.documentElement && document.documentElement.scrollTop){	 // Explorer 6 Strict
		yScroll = document.documentElement.scrollTop;
		xScroll = document.documentElement.scrollLeft;
	} else if (document.body) {// all other Explorers
		yScroll = document.body.scrollTop;
		xScroll = document.body.scrollLeft;	
	}

	arrayPageScroll = new Array(xScroll,yScroll) 
	return arrayPageScroll;
}




var sCancellationsFeed = '';
var xmlhttpcancellationsfeed;
var iCancellationsOpacity = 0;

function get_cancellationsfeed(sArea){

	sCancellationsFeed = '';
		
	if(sCancellationsFeed!=''){
		update_cancellations();
	} else {
		var d = new Date();
		

		
		load_cancellationsfeed( dirPath + 'common/cancellations_feed.asp?a=' + sArea + '&time=' + d.getFullYear() + d.getMonth() + d.getDate() + d.getHours() + d.getMinutes());
	}
}

function load_cancellationsfeed(url) {
	xmlhttpcancellationsfeed=null;

	if (window.XMLHttpRequest) {
		// code for Mozilla, etc.
		xmlhttpcancellationsfeed=new XMLHttpRequest();
	} else if (window.ActiveXObject) {
		// code for IE
		xmlhttpcancellationsfeed=new ActiveXObject("Microsoft.XMLHTTP");
	}

	if (xmlhttpcancellationsfeed!=null) {
		xmlhttpcancellationsfeed.onreadystatechange=cancellationsfeed_state_Change;
		xmlhttpcancellationsfeed.open("GET",url,true);
		xmlhttpcancellationsfeed.send(null);
	} else {
		alert("Your browser does not support XMLHTTP.");
	}
}			

function cancellationsfeed_state_Change() {

	// if xmlhttpcancellationsfeed shows "loaded"
	if (xmlhttpcancellationsfeed.readyState==4) {
		// if "OK"
		if (xmlhttpcancellationsfeed.status==200) {
			// ...some code here...		 
			sCancellationsFeed = xmlhttpcancellationsfeed.responseText;
			update_cancellations();
		}
	}
}

function update_cancellations(){	
	if (sCancellationsFeed.length > 0 ){

		var arrCancellationsFeed = sCancellationsFeed.split("\n");

		var sCancellationsBufferWidth = 860;

		sCancellationsContent = "<table cellpadding='0' cellspacing='0' border='0'><tr><td class='cancellations_cell' width='" + sCancellationsBufferWidth + "'><img src='" + dirPath + "img/clr.gif' width='" + sCancellationsBufferWidth + "' height='1' /></td><td class='cancellations_cell'><nobr>"

		for(i = 1; i <= arrCancellationsFeed.length-1; i++){
			if (i>1) {
				sCancellationsContent += "&nbsp; &nbsp;|&nbsp; &nbsp;";
			}
			sCancellationsContent += arrCancellationsFeed[i];
		}

		sCancellationsContent += "</nobr></td><td class='cancellations_cell' width='" + sCancellationsBufferWidth + "'><img src='" + dirPath + "img/clr.gif' width='" + sCancellationsBufferWidth + "' height='1' /></td></tr></table>";

		document.getElementById('cancellations_div').innerHTML = sCancellationsContent;
		
		change_opacity( document.getElementById('cancellations_div') , 0 )
		change_opacity( document.getElementById('cancellations_title_div') , 0 )
		
		document.getElementById('cancellations_div').style.display = '';
		document.getElementById('cancellations_title_div').style.display = '';

		document.getElementById('cancellations_div').scrollLeft = 565;

		scroll_cancellations();
	}
}

var iCancellationsScrollSpeed = 1;

function scroll_cancellations(){
	if (iCancellationsOpacity<100){
		iCancellationsOpacity+= 10;
		
		change_opacity( document.getElementById('cancellations_div') , iCancellationsOpacity );
		change_opacity( document.getElementById('cancellations_title_div') , iCancellationsOpacity );

		if (iCancellationsOpacity<100){
			iCancellationsTimeout = setTimeout('scroll_cancellations()', 30);
		} else {
			iCancellationsTimeout = setTimeout('scroll_cancellations()', 400);
		}
	} else {

		iTempScrollLeft = document.getElementById('cancellations_div').scrollLeft;

		document.getElementById('cancellations_div').scrollLeft+=iCancellationsScrollSpeed

		if(iTempScrollLeft==document.getElementById('cancellations_div').scrollLeft){
			if(iCancellationsScrollSpeed>0){
				document.getElementById('cancellations_div').scrollLeft = 0;
			}
		}
	
		iCancellationsTimeout = setTimeout('scroll_cancellations()', 30);
	}

}