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;
}

function position_community_footer(){
	sUserAgent = navigator.userAgent

	var arrayPageSize = getPageSize();
	if (sUserAgent.indexOf('Firefox')>-1){
		document.getElementById('footer_bar').style.top = arrayPageSize[1]-50;
	} else {
		if (sUserAgent.indexOf('Safari')>-1){
			document.getElementById('footer_bar').style.top = arrayPageSize[1]-50;
		} else {
			if (sUserAgent.indexOf('Opera')>-1){
				document.getElementById('footer_bar').style.top = arrayPageSize[1]-50;
			} else {
				document.getElementById('footer_bar').style.top = arrayPageSize[1]-50;
			}
		}
	}
	document.getElementById('footer_bar').style.display = '';
}

function show_photos_div() {
    document.getElementById('photos_div').style.display = 'block';
    document.getElementById('videos_div').style.display = 'none';

    document.getElementById('photo_tab').src = 'img/com/phototab-on.gif';
    document.getElementById('video_tab').src = 'img/com/videotab-off.gif';    
}

function show_videos_div() {
    document.getElementById('videos_div').style.display = 'block';
    document.getElementById('photos_div').style.display = 'none';

    document.getElementById('photo_tab').src = 'img/com/phototab-off.gif';
    document.getElementById('video_tab').src = 'img/com/videotab-on.gif';    
}

function validate_single_field(sFieldID, bSetFocus) {
	var bReturnTemp = true;

	if ( document.getElementById(sFieldID).value == '' ) 
	{
		if ( bSetFocus ) 
		{
			document.getElementById(sFieldID).focus();
		}
		
		bReturnTemp = false;
		
		if ( document.getElementById('label-' + sFieldID) ) 
		{
			document.getElementById('label-' + sFieldID).className = 'label-error';
		}
	} 
	else 
	{
		if ( document.getElementById('label-' + sFieldID) ) 
		{
			document.getElementById('label-' + sFieldID).className = 'label';
		}
	}
	
	return bReturnTemp;
}

function validate_registration125_form() {
	var bTemp = true;
	var sError = '';
			
	if ( validate_single_field('registrant-name', bTemp) == false ) {
		sError += 'Please enter your name\n';
		bTemp = false;	
	}
	
	if ( validate_single_field('registrant-address-1', bTemp) == false ) {
		sError += 'Please enter your address\n';
		bTemp = false;	
	}
	
	if ( validate_single_field('registrant-city', bTemp) == false ) {
		sError += 'Please enter your city\n';
		bTemp = false;	
	}
	
	if ( validate_single_field('registrant-postal-code', bTemp) == false ) {
		sError += 'Please enter your postal code\n';
		bTemp = false;	
	}
	
	if ( validate_single_field('registrant-home-phone', bTemp) == false  && validate_single_field('registrant-cell-phone', bTemp) == false) {
		sError += 'Please enter either your home phone number or cell phone number\n';
		bTemp = false;	
	}
			
	if ( validate_single_field('registrant-email', bTemp) == false ) {
		sError += 'Please enter your email\n';
		bTemp = false;	
	}
	
	if ( validate_single_field('captcha', bTemp) == false ) {
		sError += 'Please enter the green numbers\n';
		bTemp = false;	
	}
		
	if ( bTemp==false ) {
		alert(sError);
	}
	
	return bTemp;		
}