//jQuery.noConflict();
addLoadEvent(function(){
	 $("form").submit(function() {
	      $("#loadingDivHolder").show();
	      return true;
	    });
	 $(".deleteConf").click(function() {
		   if(confirm("Are you sure you want to delete this record ?\nNOTE: If you delete a collection, the related products will need to be added to a different one.")){
				if(confirm("This is your last chance to undo the cancelation of this. Please confirm or cancel the action.")){
					jQuery("#loadingDivHolder").show();
					return true;
				}else {
					return false;
				}
			}else{
				return false;
			}
	    });
	var currLocation = document.location+"";
	if(!Globals.isPublicPage && currLocation.indexOf("/add")!= -1){
		var allSelects = document.getElementsByTagName("select")
		for(var i=0;i < allSelects.length;i++){
			allSelects[i].options.selectedIndex = 0;
		}
	}	
	if(Globals.isPublicPage && Globals.isHomePage)
		Menu.setMainActive("homepageMainLink");
	else if(Globals.isPublicPage && currLocation.indexOf("services")!= -1)
		Menu.setMainActive("servicesMainLink");
	else if(Globals.isPublicPage && currLocation.indexOf("studies")!= -1)
		Menu.setMainActive("studiesMainLink");
	else if(Globals.isPublicPage && currLocation.indexOf("galleries")!= -1)
		Menu.setMainActive("galleriesMainLink");
	else if(Globals.isPublicPage && currLocation.indexOf("products")!= -1)
		Menu.setMainActive("productsMainLink");
	else if(Globals.isPublicPage && currLocation.indexOf("links")!= -1)
		Menu.setMainActive("designMainLink");
	else if(Globals.isPublicPage && currLocation.indexOf("sales-hire")!= -1)
		Menu.setMainActive("salesMainLink");
	else if(Globals.isPublicPage && currLocation.indexOf("news")!= -1)
		Menu.setMainActive("newsMainLink");
	else if(Globals.isPublicPage && currLocation.indexOf("safety")!= -1)
		Menu.setMainActive("safetyMainLink");
	else if(Globals.isPublicPage && currLocation.indexOf("contact")!= -1)
		Menu.setMainActive("contactMainLink");
	if(!Globals.isPublicPage){
		$('.topCorner').corner('top');
		$('.bottomCorner').corner('bottom');
		$('.topRightCorner').corner('tr');
		$('.topLeftCorner').corner('tl');
		$('.corner').corner();
	}
	$('a.rhsMenuExpander').click(function(){
		var idSeed = this.id.substring(this.id.lastIndexOf("_")+1,this.id.length);
		$('#'+ "rhsXpand_" + idSeed).toggle();
	});
	$('li.collapsableMenuItem a').click(function(){
		if(this.href.substring(this.href.length-1,this.href.length) == "#"){
			Menu.collapseAllMenuBlocks();
			Menu.expandMenuBlock(this.parentNode.getElementsByTagName("ul")[0].id);
			Menu.setAllListIconsClosed();
			Menu.setListIconOpen(this.parentNode);
			return false;
		}else{
			return true;
		}	
	});
	$('ul.expandableContentList li a').click(function(){
		$('ul.expandableContentList li').css({'list-style-image':'url(/css/images/collapseOpen.png)'});
		$('ul.expandableContentList li p').hide("fast");
		$('ul.expandableContentList li a').css("color","#333");
		$(this).parent().css({'list-style-image':'url(/css/images/collapseClose.png)'});
		$(this).next().show("fast");
		$(this).css("color","#74B14A");
		return false;
	});
	
});

