/* PlanetApparel */
//SHOW-HIDE DISPLAY AND VISIBILITY------------------------------------------------------------------------------------------------------------
//USAGE: <a href="javascript:ShowDis('TargetID');">Show Display/Visibility</a>
function ShowDis(a) {document.getElementById(a).style.display = "block";}
function ShowVis(a) {document.getElementById(a).style.visibility = "visible";}
//USAGE: <a href="javascript:HideDis('TargetID');">Hide Display/Visibility</a>
function HideDis(a) {document.getElementById(a).style.display = "none";}
function HideVis(a) {document.getElementById(a).style.visibility = "hidden";}
//USAGE: <a href="javascript:ShowHideDis('TargetID');">Show/Hide Display/Visibility</a>
//NOTE: Make sure target's display is actually set to block or none / visible or hidden first.
function ShowHideDis(a) {
	if(document.getElementById(a).style.display == "none") {document.getElementById(a).style.display = "block";}
	else {document.getElementById(a).style.display = "none";}
}
function ShowHideVis(a) {
	if(document.getElementById(a).style.visibility == "hidden") {document.getElementById(a).style.visibility = "visible";}
	else {document.getElementById(a).style.visibility = "hidden";}
}

//SWAPPING FUNCTIONS--------------------------------------------------------------------------------------------------------------------------
//Function to swap image or iframe source:
//USEAGE: <a href="javascript:SwapSrc('TargetID','NewSourcePath');">Swap Source</a>
function SwapSrc(a,b) {document.getElementById(a).src = b;}
//Function to swap a container's HTML content:
//USEAGE: <a href="javascript:SwapSrc('TargetID','<h2>New Header</h2><p>new text</p>');">Swap HTML</a>
function SwapHTML(a,b) {document.getElementById(a).innerHTML = b;}
//Function to swap css class:
//USEAGE: <a href="javascript:SwapClass('TargetID','code red');">Swap Class</a>
function SwapClass(a,b) {document.getElementById(a).className = b;}
//Function to swap other element properties (obviously only supports the included properties):
//USAGE: <a href="javascript:SwapProp('TargetID','height','300px');">Swap Property</a>
function SwapProp(a,b,c) {
	if(b == 'width') {document.getElementById(a).style.width = c;}
	if(b == 'height') {document.getElementById(a).style.height = c;}
	if(b == 'color') {document.getElementById(a).style.color = c;}
	if(b == 'background') {document.getElementById(a).style.background = c;}
	if(b == 'display') {document.getElementById(a).style.display = c;}
	if(b == 'left') {document.getElementById(a).style.left = c;}
	if(b == 'top') {document.getElementById(a).style.top = c;}
}

//POPUP WINDOW FUNCTIONS----------------------------------------------------------------------------------------------------------------------
//Function to launch Adjustable Size Popup Window
//USEAGE: <a href="javascript:PopupWindowFixed('target.html', 'idname', 600, 390);">Click here for popup window.</a>
function PopupWindow(Source, Name, Width, Height) { 
Options = "toolbar=0,location=0,directories=0,menubar=0,scrollbars=1,resizable=1,width=" + Width + ",height=" + Height;
window.open(Source, Name, Options); 
}
//Function to launch Fixed Size Popup Window
//USEAGE: <a href="javascript:PopupWindowFixed('target.html', 'idname', 600, 390);">Click here for popup window.</a>
function PopupWindowFixed(Source, Name, Width, Height) { 
Options = "toolbar=0,location=0,directories=0,menubar=0,scrollbars=0,resizable=0,width=" + Width + ",height=" + Height;
window.open(Source, Name, Options); 
}

//FLASH GENERIC EMBED LOADER------------------------------------------------------------------------------------------------------------------
//	This is the most cross browser compatible solution I have come up with thus far: ditch the object tag.
//	EmbedSWF resizes the target container and adds an optional background, then uses an innerHTML rewrite to populate it with the proper embed tag.
//	HTML: <div class="mauto rel beveled5 txtcenter" id="swfbox"><!-- swf gets inserted here by EmbedSWF --></div>
//	USEAGE: Call the target container's ID, the full path to the swf file to load, width, height, optional background, and optional FlashVars:
//	EmbedSWF('TargetID','../mymedia/NewFile.swf',600,400,'#000','file=this&buffertime=that&variable=something');
//	Use a set of empty quotes for the background if you want to leave it blank but still include FlashVars.
//	To have the page initialize with a file pre-loaded, place a script in a hidden p tag (if excluded, the container will remain empty):
//	<p class="dispnone"><script type="text/javascript">EmbedSWF('TargetID','../mymedia/NewFile.swf',600,400,'#000','file=this&buffertime=that&variable=something');< /script ></p>
//	AND/OR include multiple links to load more swf files by placing scripts inside link tags:
//	<p><a href="#" onclick="EmbedSWF('TargetID','../mymedia/NewFile.swf',600,400,'#000','file=this&buffertime=that&variable=something');">Load SWF</a></p>
//	Optional content may follow -mta
function EmbedSWF(t,p,w,h,b,v){
document.getElementById(t).style.width=w+"px"; document.getElementById(t).style.height=h+"px"; document.getElementById(t).style.background=b;
document.getElementById(t).innerHTML="<embed src="+p+" height='100%' width='100%' type='application/x-shockwave-flash' quality='high' wmode='transparent' align='center' allowscriptaccess='always' allowfullscreen='true' pluginspage='http://www.adobe.com/go/getflashplayer/' FlashVars='"+v+"'></embed>";
}

