// FLASH-JS Based SOLUTION

function changeBackground(imgIndex){
	backgroundMovie=getFlashMovieObject("background");
	//backgroundMovie.Zoom(0);	
	backgroundMovie.SetVariable("/background/:imgIndex", imgIndex);	
}


function getFlashMovieObject(movieName)
{
  if (window.document[movieName]) 
  {
    return window.document[movieName];
  }
  if (navigator.appName.indexOf("Microsoft Internet")==-1)
  {
    if (document.embeds && document.embeds[movieName])
      return document.embeds[movieName]; 
  }
  else // if (navigator.appName.indexOf("Microsoft Internet")!=-1)
  {
    return document.getElementById(movieName);
  }
}



// HTML BASED SOLUTION
function setBackground(img){
	if(document.body){
		document.body.background=img;
	}
}

function setBackgroundTo(img){
	var elem=document.getElementById('background');	
	if(elem){
		resizeBackground(elem);
		elem.setAttribute('src', img);		
	}
	return;
}

function resizeBackground(elem){
	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;
  	}else{
			myWidth = 1600;
    			myHeight = 1070;
	}
	elem.width=myWidth;
	elem.height=myHeight;
	return;
}

function resizeSwf(elem){
	back=document.getElementById(elem);
	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;
  	}else{
			myWidth = 1600;
    			myHeight = 1070;
	}
	back.setAttribute("width", "2000");
	alert("width changed!");
	return;
}
