window.onload = function () {
 // add ribbon to site
	//addCornerRibbon();
}
function addCornerRibbon() {

		var dv 	= document.getElementById('liner1');
		var lnk 		= document.createElement('a');
		
		lnk.setAttribute('id', 'cornerRibbon');
		
		// set link attributes
		lnk.setAttribute('style', 'top: 0');
		lnk.setAttribute('title', 'Win Movie Tickets for a Year!');
		lnk.setAttribute('href', '/sweeps');
		
		// add child
		dv.appendChild(lnk);

} // end function

function portiPopup(url, name, w, h, mode) {  // no status bar, scroll bars, resizable
	var w = w - 0;
	var h = h - 0;

	if (mode == "fullscreen") {
		var winW = 0;
		var winH = 0;
		w = screen.width;
		h = screen.height;
	}
	else if (mode == "fullheight") {
		var winH = 0;
		h = screen.height;
		var winW = (screen.width - w);
	}
	else {
		var winW = (screen.width - w) / 2;
		var winH = (screen.height - h) / 2;
		w += 30;
		h += 30;
	}
	var win2 = window.open(url,name,'width='+w+',height='+h+',top='+winH+',left='+winW+',toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes');
	win2.focus();
}

//--- show/hide ----------------------------------

function showhide(div) {
	var styleObj = document.getElementById(div);
	if (styleObj.style.visibility == "visible")
		styleObj.style.visibility = "hidden";
	else styleObj.style.visibility = "visible";
}

function hide(div) {
	var styleObj = document.getElementById(div);
	styleObj.style.visibility = "hidden";
}


// ****************************************************************
// *** Resize Functions
function easeInOut(minValue,maxValue,totalSteps,actualStep,powr) { 
//Generic Animation Step Value Generator By www.hesido.com 
    var delta = maxValue - minValue; 
    var stepp = minValue+(Math.pow(((1 / totalSteps) * actualStep), powr) * delta); 
    return Math.ceil(stepp) 
    }
function doWidthChangeMem(elem,startWidth,endWidth,steps,intervals,powr) { 
//Width changer with Memory by www.hesido.com
    if (elem.widthChangeMemInt)
	window.clearInterval(elem.widthChangeMemInt);
    var actStep = 0;
    elem.widthChangeMemInt = window.setInterval(
	function() { 
	  elem.currentWidth = easeInOut(startWidth,endWidth,steps,actStep,powr);
	  elem.style.width = elem.currentWidth + "px"; 
	  actStep++;
	  if (actStep > steps) window.clearInterval(elem.widthChangeMemInt);
	} 
	,intervals)
}
// ****************************************************************
// *** window width
function windowWidth() {
  var myWidth = 0, myHeight = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myWidth = window.innerWidth;
    myHeight = window.innerHeight;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    myWidth = document.documentElement.clientWidth;
    myHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    myWidth = document.body.clientWidth;
    myHeight = document.body.clientHeight;
  }
  //window.alert( 'Width = ' + myWidth );
  //window.alert( 'Height = ' + myHeight );
  return myWidth;
}