
//function to view gallery and downloads

function showPhoto(photo){
	var preview = photo.getAttribute("href");
	var holder = document.getElementById("photoholder");
	holder.setAttribute("src",preview);
};

function updateWallpaper(photo,lowreslink,hireslink){
	var preview = photo.getAttribute("href");
	var holder = document.getElementById("photoholder");
	holder.setAttribute("src",preview);
	
	var download1 = document.getElementById("lowres");
	download1.setAttribute("href","downloads/" + lowreslink);
	var download2 = document.getElementById("hires");
	download2.setAttribute("href","downloads/" + hireslink);
	
};

function thisSound() {
  // IE and Netscape refer to the movie object differently.
  // This function returns the appropriate syntax depending on the browser.
  if (navigator.appName.indexOf ("Microsoft") !=-1) {
    return window.document.sdSWF
  } else {
    return window.document.sdSWF[1]
  }  
}

var mainMovie
function myMovie_DoFSCommand(command, args) {
	var soundObj = thisSound();
	
	if(command=="off") {
		//sdSWF.TCallLabel("_root", "updSound")
		soundObj.TCallLabel("_root", "updSound")
	} else if(command=="on") {
		//sdSWF.TCallLabel("_root", "dwnSound")
		soundObj.TCallLabel("_root", "dwnSound")
	}
}

// functions to handle sound 
function createCookie(name,value,days) {
	if (days) {
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
}

function readCookie(name) {
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}

function eraseCookie(name) {
	createCookie(name,"",-1);
}

function UserSound(trigger){
	if(trigger=="off")
	{
		UserSoundOff = "1"
		UserSoundOn = "0"
		createCookie('SoundOff','1',1);
		createCookie('SoundOn','0',1);
		
	}else if(trigger=="on")
		{ 
			UserSoundOff = "0"
			UserSoundOn = "1"	
			createCookie('SoundOff','0',1);
			createCookie('SoundOn','1',1);
		}	
		
}

var UserSoundOn = "0";
var UserSoundOff = "0";

var IniUserSoundOn = readCookie('SoundOn');
if (IniUserSoundOn == null)
createCookie('SoundOn','0',1);
else
UserSoundOn = IniUserSoundOn;

var IniUserSoundOff = readCookie('SoundOff');
if (IniUserSoundOff == null)
createCookie('SoundOff','0',1);
else
UserSoundOff = IniUserSoundOff;

