try {
  document.execCommand("BackgroundImageCache", false, true);
} catch(err) {}
//
// include JS files
//document.domain="send6.net";
new Asset.javascript("/js/swfupload.js");
new Asset.javascript("/js/images_hover_pngfix.js");
new Asset.javascript("/js/swfuploadhandlers.js");
new Asset.javascript("/js/flashDetection.js");
//
// Init login box controllers' behaviors
function fInitLoginBox() {
	var usr = $("UserName");
	if (usr) {
		usr.value = "";
        
		usr.addEvents({
			"focus": function(e){
				usr.setStyle("background", "#fff");
			},
			"blur": function(e){
				usr.setStyle("background", usr.value.trim()=="" ? "" : "#fff");
			}
		});
	}
	//
	var pwd = $("Password");
	if (pwd) {
		pwd.value = "";
		pwd.addEvents({
			"focus": function(e){
				pwd.setStyle("background", "#fff");
			},
			"blur": function(e){
				pwd.setStyle("background", pwd.value.trim()=="" ? "" : "#fff");
			}
		});
	}
}
// Initialize home intro box
// Slide in effect when clicking on tabs
function fInitHomeIntro() {
	var oBox = $("homeIntro");
	var slideIndex = 0;
	var delay = 5000;
	var slideInterval;
	if (!oBox) return;
	//
	var tabs = new Array();
	tabs[0] = new Element("div").setProperty("id", "tabContent1").setOpacity(1).injectInside(oBox);
	tabs[1] = new Element("div").setProperty("id", "tabContent2").setOpacity(0).injectInside(oBox);
	tabs[2] = new Element("div").setProperty("id", "tabContent3").setOpacity(0).injectInside(oBox);
	//
	var btns = oBox.getElements("a");
	// add buttons' behaviors
	btns.each(function(el, i){
		el.addEvents({
			"click": function(e){
				new Event(e).stop();
				// set selected tab
				var btnGrp = el.getParent().getParent().getParent();
				btnGrp.className = el.getParent().id;
				// show selected tab content by sliding down
				slideIt(i);
			},
			"mouseover": function(){
				clearInterval(slideInterval);
			},
			"mouseout": function() {
				clearInterval(slideInterval);
				slideInterval = setInterval(autoSlide, delay);
			}
		});
	});
	// set tab content click events
	tabs.each(function(el, i){
		el.addEvents({
			"click": function(e){
				new Event(e).stop();
				window.location = btns[i].href;
			},
			"mouseover": function(){
				clearInterval(slideInterval);
			},
			"mouseout": function() {
				clearInterval(slideInterval);
				slideInterval = setInterval(autoSlide, delay);
			}
		});
	});
	//
	// function auto slide
	slideInterval = setInterval(autoSlide, delay);
	function autoSlide(){
		//
		slideIndex++;
		if (slideIndex == 3) {
			slideIndex = 0;
		}
		// set selected tab
		var el = btns[slideIndex];
		var btnGrp = el.getParent().getParent();
		btnGrp.className = el.id;
		//
		slideIt(slideIndex);
		
	}
	function slideIt(index) {
		// show selected tab content by sliding down
		for (var j = 0; j < tabs.length; j++) {
			if (j != index) {
				tabs[j].setOpacity(0);
			} else {
				tabs[j].setOpacity(1);
				new Fx.Style(tabs[j], "height").start(0, 200);
			}
		}
		slideIndex = index;
	}
}

function fInitFAQ() {
	$$(".faq").each(function(ul){
		var togglers = ul.getElements("h4");
		var contents = ul.getElements("div");
		new Accordion(togglers, contents, {
			show: -1,
			opacity: false,
			alwaysHide: true,
			onActive: function(el){
				el.addClass("active");
			},
			onBackground: function(el){
				el.removeClass("active");
			}
		});
	});
}

window.addEvent("load", function(){
	
	if(typeof(fInitUploadForm)=="function")
		fInitUploadForm();
	if(typeof(fInitLoginBox)=="function")
		fInitLoginBox();
	
	//fInitHomeIntro();
	initImages();
	fInitFAQ();
});

function fDisplayForm()
{
	if($("sub"))
		$("sub").setStyle("visibility", "visible");

	if($("divRequireFlash"))
		$("divRequireFlash").setStyle("display", "none");
}

//show size in readable format

