//      .::.  gyrewire.com JavaScript library  .::.


//    .::.  Browser check  .::.

IS_DOM = (document.getElementById) ? true : false;
IS_IE = (document.all) ? true : false;
browserName = navigator.appName;


	
function getThis(sId){

		var oObject;
		oObject = false;
		
		if (IS_DOM) {
			if (document.getElementById(sId)) {
				oObject = document.getElementById(sId);
			}
		}
		else if (IS_IE)
		{
			if (document.all[sID]) {
				oObject = document.all[sID];
			}
		}
		return oObject;
}


//toggle admin/edit layers


function toggleLayerDisplay(sDivID){
					   
			var ndTargetLayer = getThis(sDivID);

			if(ndTargetLayer.style.display == 'none'){
				ndTargetLayer.style.display = 'block';
			}else{
				ndTargetLayer.style.display = 'none';
			}
			
}


function toggleDisplay(sDivID,sNum,pFix){
	
	clearLayerDisplay(sNum,pFix);
	
	var targetLayer = getThis(sDivID);

	if(targetLayer.style.display == 'none'){
		targetLayer.style.display = 'block';
	}else{
		targetLayer.style.display = 'none';
	}
	
}

function clearLayerDisplay(sNum,pFix){
	
	for(i=1; i<=sNum; i++)
	{
		
		var targetLayer = getThis(pFix+i);
		targetLayer.style.display = "none";
		
	}
	
}

function toggleClass(thisNum,totalNum,pFix){

	for(var i=1; i<=totalNum; i++)
	{	
		var targetLayer = getThis('thumb'+ pFix+i);
		targetLayer.className = 'thumbUp';
		
		var targetLayer = getThis('caption'+pFix+i);
		targetLayer.style.display = 'none';

	}
	
	var targetLayer = getThis('thumb'+pFix+thisNum);
	targetLayer.className = 'thumbOver';
	var targetLayer = getThis('caption'+pFix+thisNum);
	targetLayer.style.display = 'block';
	
}

function swapImg(sNum, iSrc, tNum)
{

		var tLyr = getThis('bigImg'+sNum);
		tLyr.src = '/images/l/'+ iSrc;
		
		var iLyr = getThis('isMainImage' + sNum);
				if(iLyr.style.display == 'none'){
					for(i=1; i<=tNum; i++){
						if(i != sNum){
							var aLyr = getThis('isMainImage'+i);
							aLyr.style.display = 'none';
							var shBtn = getThis('shBtn' + i);
							shBtn.innerHTML = "+ SHOW big image";
						}
					}
						iLyr.style.display = 'block';
						var shBtn = getThis('shBtn' + sNum);
						shBtn.innerHTML = "- HIDE big image";
				}
}

function hideBig(sNum){
					   
			var tLyr = getThis('isMainImage' + sNum);
			if(tLyr.style.display == 'none'){
					tLyr.style.display = 'block';
					var shBtn = getThis('shBtn' + sNum);
					shBtn.innerHTML = "- HIDE big image";
			}else{
					tLyr.style.display = 'none';
					var shBtn = getThis('shBtn' + sNum);
					shBtn.innerHTML = "+ SHOW big image";
			}
}


function showBig(sNum, tNum){

	for(var i=1; i<=tNum; i++){
			var tLyr = getThis('isMainImage' + i);
			if(i == sNum)
			{
				tLyr.style.display = 'block';
				var shBtn = getThis('shBtn' + i);
				shBtn.innerHTML = "- HIDE big image";
			}
			else
			{
				tLyr.style.display = 'none';
				var shBtn = getThis('shBtn' + i);
				shBtn.innerHTML = "+ SHOW big image";
			}
	}					   

}


function flashWrite(flashVars, src, width, height, wmode){
document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="'+width+'" height="'+height+'"><param name="movie" value="'+src+'" /><param name="quality" value="high" /><param name="wmode" value="'+wmode+'" /><param name="FlashVars" value="'+flashVars+'" /><embed src="'+src+'" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="'+width+'" height="'+height+'" wmode="'+wmode+'" FlashVars="'+flashVars+'"></embed></object>');
}
