/**
 * Add by Imad Sader
 * 12 11 07
 *
 * this function is for the Image Swap effect
 **/

function imageOver(thisImage, overImage)
{
  thisImage.src = "http://www.itwproline.com.au/Images/userUploadedImages/" + overImage;
}



function GetITWTree(folderid)
{
	var urlpath;
	var fileindex;
	
	fileindex = window.location.href.lastIndexOf('/')
	urlPath = window.location.href.slice(0,fileindex)
	
	var xmlhttp=false;
	var hasError=0;

	try 
		{ 
			xmlhttp = new ActiveXObject('MSXML2.XMLHTTP'); 
		}
	catch(e) 
		{
			try 
				{ 
					xmlhttp = new ActiveXObject('Microsoft.XMLHTTP'); 
				}
				catch(e) 
				{ 
				hasError=1;
				}
		}

	if (!xmlhttp && typeof(XMLHttpRequest) != 'undefined') 
		{
			try 
			{ 
				xmlhttp = new XMLHttpRequest();hasError=0; 
				}
			catch(e) 
			{ hasError=1;}
		}

	if (!xmlhttp && window.createRequest) 
		{
			try 
			{
				 xmlhttp = window.createRequest();hasError=0; 
				}

			catch(e) 
			{ hasError=1;}
		}

	if (hasError == 0)
		{ 
			try 
				{
					netscape.security.PrivilegeManager.enablePrivilege('UniversalBrowserRead');
				} 
				catch (e)
				{}

	var url= urlPath + '/boulevard/SubCategories.aspx?folderid=' + folderid;

	xmlhttp.open('GET', url, true);

	xmlhttp.onreadystatechange=function()
	{
		if (xmlhttp.readyState==4) 
		{
			document.getElementById('DivFolderTree').innerHTML = '';
			document.getElementById('DivFolderTree').innerHTML = xmlhttp.responseText;
		}
	}
	xmlhttp.send(null); 
	}
} 

function openWnd(pagename,title,hiddenId,id)
{
	var hiddenTag = document.getElementById(id);
	var hier = hiddenTag.value;
	
	var hiddenFolderId = document.getElementById(hiddenId);
	window.open(pagename + '&folderid='+hiddenFolderId.value + '&breadcrumbs=' + hier , title, 'toolbar=yes,width=800,height=650,resizable, scrollbars');
}
function ToggleUL(thisLI)
{
	//When toggling the li's toggle only the child list (ul's) and not the current li's because the current li should be shown			

	var childULs= new Array();
	var subchildLIs = new Array();
	
			childULs = thisLI.childNodes;			
			for( var index = 0; index < childULs.length; index++ ) 
			{
				if(childULs[index].nodeName == "UL")
				{
					//Get the child li's of the ul
					subchildLIs = childULs[index].childNodes;
	
					//toggle all the child li's as "show" or "noshow"			
					for(var subindex=0; subindex < subchildLIs.length; subindex++)
					{
						if (subchildLIs[subindex].nodeName == "LI")	
							if (subchildLIs[subindex].className == "show")
							{
								subchildLIs[subindex].className = "";
							}
							else
							{
								subchildLIs[subindex].className = "show";
							}
					}						
							
				}
			}		
										
}