function ClearSearch() {
	try {
		var element = window.document.getElementById('SearchKeywords');
		if(element.value=='Search QuantumCMS.com'){
			element.value='';
		}else{}
	} catch(e) {}
}

function WriteSearch() {
	try {
		var element = window.document.getElementById('SearchKeywords');
		if(element.value==''){
			element.value='Search QuantumCMS.com';
		}else{}
	} catch(e) {}
}

ReplaceSearch = function() {
	try {
		var elements = window.document.getElementById('SearchKeywords');
		if(window.addEventListener){	
			elements.addEventListener('focus', ClearSearch, true);
			elements.addEventListener('blur', WriteSearch, true);	
		}else{
			elements.attachEvent("onfocus",ClearSearch);
			elements.attachEvent("onblur",WriteSearch);
		}
	} catch(e) {}
}

if(window.addEventListener) window.addEventListener('load', ReplaceSearch, false); // gecko, safari, konqueror and standard
else if(document.addEventListener) document.addEventListener('load', ReplaceSearch, false); // opera 7
else if(window.attachEvent) { // win/ie
	window.attachEvent('onload', ReplaceSearch);
} else { // mac/ie5
	if(typeof window.onload == 'function') {
		var existing = onload;
		window.onload = function() {
			existing();
			ReplaceSearch();
		}
	} else {
		window.onload = function() {
			ReplaceSearch();
		}
	}
}


WriteFlash = function() {
	try {

		var strL='';
		strL+='	<object type="application\/x-shockwave-flash" data="\/files\/flash\/sub_left.swf" width="250" height="105" title="">';
		strL+='		<param name="wmode" value="transparent">';
		strL+='		<param name="movie" value="\/files\/flash\/sub_left.swf">';
		strL+='	<\/object><br clear="all">';

		var strR='';
		strR+='	<object type="application\/x-shockwave-flash" data="\/files\/flash\/sub_right.swf" width="495" height="105" title="">';
		strR+='		<param name="wmode" value="transparent">';
		strR+='		<param name="movie" value="\/files\/flash\/sub_right.swf">';
		strR+='		<param name="FlashVars" value="image=185">';
		strR+='	<\/object><br clear="all">';

		var elementL = window.document.getElementById('FlashLeft');
		var elementR = window.document.getElementById('FlashRight');

		elementL.innerHTML = strL;
		elementR.innerHTML = strR;

	} catch(e) {}
}



function SwitchIntro(numIntro, showIntro) {
	try{
		if (numIntro > 1){document.getElementById("Rotator").style.display="block";}
		if (!showIntro){showIntro = 1;}
		for(i=1; i<=numIntro; i++){
			document.getElementById("IntroContent_"+i).style.display="none";
			document.getElementById("Rotator").getElementsByTagName("img")[i-1].src="/files/images/template/rotator_btn.gif";
		}
		document.getElementById("IntroContent_"+showIntro).style.display="block";
		document.getElementById("Rotator").getElementsByTagName("img")[showIntro-1].src="/files/images/template/rotator_btn_sel.gif";

	}catch(e){}
}



// Folders View Gallery Functions

// Set the variable outside of the functions
var OldThumb;
var CurrentPos;

function ShowBigImg(pos,thumbImg) {
	try {
		var spacerPath = "/files/images/std/spacer.gif";
		var tmpWidth;
		var tmpHeight;

		// Reset large photo to new image
		var BigPhoto = window.document.getElementById("BigPhoto");
		BigPhoto.src = spacerPath;

		// Pass in the thumbnail image you've clicked, then set the old one to clear the class, then set the class on the one you clicked
		var NewThumb = thumbImg;
		if(OldThumb==undefined){
		}else{
			var OldThumbImg = document.getElementById(OldThumb);
			OldThumbImg.className = "";
		}
		var NewThumbImg = document.getElementById(NewThumb);
		NewThumbImg.className = "Sel";

		OldThumb = NewThumb;
		CurrentPos = pos;

		BigPhoto.src = AllImgs[pos];
	} catch(e) {}
}

function SimplePrevNext(ArrayName,PN){
	try{
		ArrayCount = parseInt(eval(ArrayName + ".length"));
		ArrayPos = parseInt(CurrentPos);
		CollectionPos = parseInt(ArrayPos + 1);

		if(PN=="P"){
			if(ArrayPos==0 || ArrayPos==undefined){
				PrevArrayPos = parseInt(ArrayCount-1);
				PrevCollectionPos = ArrayCount;
			}else{
				PrevArrayPos = parseInt(ArrayPos-1);
				PrevCollectionPos = parseInt(CollectionPos-1);
			}
			NewArrayPos = PrevArrayPos
			NewCollectionPos = PrevCollectionPos
		}else{

			if(CollectionPos>=ArrayCount){
				NextArrayPos = parseInt(0);
				NextCollectionPos = parseInt(1);
			}else{
				NextArrayPos = parseInt(ArrayPos+1);
				NextCollectionPos = parseInt(CollectionPos+1);
			}
			NewArrayPos = NextArrayPos
			NewCollectionPos = NextCollectionPos
		}

		NewThumb = "Thumb_" + NewArrayPos;
		ShowBigImg(NewArrayPos,NewThumb);
	}catch(e){}
}

function DrawTutorial(SWFPath,SWFWidth,SWFHeight,SWFParams) {
	try {
		var playerVersion = swfobject.getFlashPlayerVersion(); // returns a JavaScript object
		if (swfobject.hasFlashPlayerVersion("9.0.0")) {
			var str = '\n';
			var NewParams = '';
			str+='	<object type="application\/x-shockwave-flash" data="' + SWFPath + '" width="' + SWFWidth + '" height="' + SWFHeight + '" title="">\n';
			str+='		<param name="wmode" value="transparent">\n';
			str+='		<param name="movie" value="' + SWFPath + '">\n';
			str+='	<\/object>\n';
			document.getElementById("Tutorial").innerHTML = str;
		}
	} catch(e) {}
}

