function ChkAllDownload(obj, elname) {
    var el = eval("document.getElementsByName('"+elname+"')");

    for(i=0;i<el.length;i++){
        el[i].checked = obj.checked;
    }
 }

function ChkDownload(obj, elname) {
    var el = eval("document.getElementById('"+elname+"')");	

    if(! obj.checked) {
        el.checked = false;
    }
}

function isIE() {
	if (navigator.userAgent.indexOf("MSIE") >= 0) {
		return true;
	} else {
		return false;
	}
}

function CreateBookmarkLink() {
    title = "파일플러스";
    url = "http://fileplus.co.kr";
    //FF
    if (window.sidebar) {
        window.sidebar.addPanel(title, url,"");
    }
    //IE
    else if( window.external ) {
        window.external.AddFavorite( url, title);
    }
    //Opera
    else if(window.opera && window.print) {
        return true;
    }
}

function adult_confirm(){
	var url = "/ajax/ajax.isAdultChk.php";
	new Ajax.Request(url,   {
		method:'get',
		onSuccess: function(transport) {
			var response = transport.responseText || "no response text";
			var arrStr = response.split('|^^|');
			
			if(arrStr[0] == "SUCCESS") {
				location.href = "/user/wishfile.php?category=4";
				return;
			} else {
				if(arrStr[1] == "E001") {
					error(arrStr[1]);
				} else {
					if(! confirm("For Adult Only. Would you continue?")) { return false; }
					opener.location.href = "/user/adultAuth.php";
				}	
			}
			
		},
		onFailure: function(){ alert('Something went wrong...') }   });
}

function tv_join () {
	var top = (browser.screenheight - 570) / 2;
	var left = (browser.screenwidth - 530) / 2;

	var url = '/user/tv_login.php';
	var popup = window.open(url, 'popup_tvjoin', 'left='+left+', top='+top+', width=530, height=330, resizable=0');

	if(! popup) {
		alert('Popup window blocked.');
		//location.href = "http://www.folderplus.com/?fpMain=3";
	}

	popup.focus();
}


function todayViewDel(str,ip){
	var url = "/ajax/ajax.history.php?th_idx="+str+"&ip="+ip;
	new Ajax.Request(url,   {
		method:'get',
		onSuccess: function(transport) {
			var response = transport.responseText || "no response text";
			var arrStr = response.split('|^^|');
		
			document.getElementById("layer_quck").innerHTML = arrStr[1];

			if(arrStr[0] > 3){
				var roll_quick = new js_rolling(document.getElementById('divhistory'));
				document.getElementById('divhistory').style.height = '230';
				roll_quick.set_direction(3);
				roll_quick.move_gap = 1;
				roll_quick.time_dealy = 10;
				roll_quick.time_dealy_pause = 1000;
				roll_quick.start();
			}		
			
		},
		onFailure: function(){ alert('Something went wrong...') }   });
}


window.onload = function(){
	try{		
		hFrame.init();
		browser.browsersize();
		if(document.body.scrollHeight < browser.height){
			

			height =  browser.height - document.body.scrollHeight;
			document.getElementById("foot_height").style.height=height+30;
		}

		js_fileplus.useBrowser = browser.browser();
	} catch(e) {}
}




function flash_tv_join(){

	var url = '';
	var top = (browser.screenheight - 270) / 2;
	var left = (browser.screenwidth - 400) / 2;

	url = 'http://www.folderplus.com/engine/popup/tv_join.php';

	var popupTVjoin = window.open(url, 'popupTVjoin', 'left='+left+', top='+top+', width=430, height=580, resizable=0');

	if(! popupTVjoin) {
		alert('Popup window blocked.');
	//location.replace("/user/login.php");
	}

	popupTVjoin.focus();
}