var target_browser = '';

//alert(navigator.userAgent);

if ( (navigator.userAgent.indexOf('MSIE 5.12') != -1 ) && (navigator.userAgent.indexOf('Windows') != -1) ){
	target_browser='win-ie';
} else if ( (navigator.userAgent.indexOf('Opera') != -1) && (navigator.userAgent.indexOf('Windows') != -1) ){
	target_browser='Opera-win';
} else if ( (navigator.userAgent.indexOf('Opera') != -1) && (navigator.userAgent.indexOf('Mac_PowerPC') != -1) ){
	target_browser='Opera-mac';
} else if ( (navigator.userAgent.indexOf('MSIE 5.2') != -1) && (navigator.userAgent.indexOf('Windows') != -1)  ){
	target_browser='win-ie';
} else if ( (navigator.userAgent.indexOf('MSIE 5.2') != -1) && (navigator.userAgent.indexOf('Mac_PowerPC') != -1) ){
	target_browser='mac-ie-OSX';
} else if ( (navigator.userAgent.indexOf('MSIE 5.0') != -1) && (navigator.userAgent.indexOf('Mac_PowerPC') != -1) ){
	target_browser='mac-ie-OS9';
} else if ( (navigator.userAgent.indexOf('MSIE 7.0') != -1) && (navigator.userAgent.indexOf('Windows') != -1) ){
	target_browser='win-ie7';
} else if ( (navigator.userAgent.indexOf('MSIE 6.0') != -1) && (navigator.userAgent.indexOf('Windows') != -1) ){
	target_browser='win-ie6';
} else if ( (navigator.userAgent.indexOf('MSIE 5.5') != -1) && (navigator.userAgent.indexOf('Windows') != -1) ){
	target_browser='win-ie55';
} else if ( (navigator.userAgent.indexOf('Netscape') != -1) && (navigator.userAgent.indexOf('Windows') != -1) ){
	target_browser='win-netscape';
} else if (navigator.userAgent.indexOf('Safari/3') != -1) {
	target_browser='safari3';
} else if (navigator.userAgent.indexOf('Safari/4') != -1) {
	target_browser='safari4';
} else if ( (navigator.userAgent.indexOf('Mozilla/5') != -1) && (navigator.userAgent.indexOf('Windows') != -1) ){
	target_browser='firefox_win';
} else if ( (navigator.userAgent.indexOf('Mozilla/5') != -1) && (navigator.userAgent.indexOf('Macintosh') != -1) ){
	target_browser='firefox_mac';
} else {
	target_browser='unknown';
}

//alert(target_browser);

if(target_browser == 'safari3'){
	

		
}  else if (target_browser == 'safari4') {


		
}  else if (target_browser == 'win-ie6') {
	document.writeln('<style type="text/css">');
	document.writeln('<!--');
//	document.writeln('body{ background-image:url("image/back_image.jpg");}');
	document.writeln('div#center {width	:	510px;}');
	document.writeln('div#document {width	:	510px;}');
	document.writeln('div#frame {width	:	935px;}');
	document.writeln('div#main{width	:	935px;}');
	document.writeln('.direct_text {font-size	:	10px;}');
	document.writeln('div#tab_menu li {padding:5px 0.5em 0px 0.5em;}');
	document.writeln('div#tab_menu li a {padding:7px 0 0px 0}');
	document.writeln('.update_text {margin: 0 0 13px 0; }');
	document.writeln('div#campaign_box_article {font-size:15px;}');
	document.writeln('div#campaign_box_article {font-weight:500;}');
	document.writeln('div#campaign_box_article p a {font-size: 15px;}');
	document.writeln('-->');
	document.writeln('</style>');



} else if (target_browser == 'win-ie55') {
	document.writeln('<style type="text/css">');
	document.writeln('<!--');
//	document.writeln('body{ background-image:url("image/back_image.jpg");}');
//	document.writeln('div#menu li a { padding: 4px 0; }');
	document.writeln('-->');
	document.writeln('</style>');

} else if (target_browser == 'win-netscape'){
	document.writeln('<style type="text/css">');
	document.writeln('<!--');
//	document.writeln('body{ background-image:url("image/back_image.jpg");}');
//	document.writeln('div#menu li a { padding: 4px 0; }');
	document.writeln('-->');
	document.writeln('</style>');

} else if (target_browser == 'mac-ie-OSX'){
	document.writeln('<style type="text/css">');
	document.writeln('<!--');
	document.writeln('div#frame {width	:	940px;}');
	document.writeln('div#main {width	:	940px;}');
	document.writeln('-->');
	document.writeln('</style>');
	
	
//	window.alert("MacOX-9");
} else if (target_browser == 'Opera-win'){
	document.writeln('<style type="text/css">');
	document.writeln('<!--');
//	document.writeln('body{ background-image:url("image/back_image.jpg");}');
//	document.writeln('div#menu li a { padding: 4px 0; }');
	document.writeln('-->');
	document.writeln('</style>');
//	document.writeln('<div id="contents"><img src="image/top_image.jpg" /></div>');
} else if (target_browser == 'Opera-mac'){
	document.writeln('<style type="text/css">');
	document.writeln('<!--');
//	document.writeln('body{ background-image:url("image/back_image.jpg");}');
	document.writeln('-->');
	document.writeln('</style>');
//	document.writeln('<div id="contents"><img src="image/top_image.jpg" /></div>');
} else if (target_browser == 'firefox_win'){

	
} else if (target_browser == 'firefox_mac'){
	

	
} else {
	document.writeln('<style type="text/css">');
	document.writeln('<!--');
	document.writeln('div#tab_menu li {padding:5px 0.5em 3px 0.5em;}');
	document.writeln('div#tab_menu li a {padding:3px 0 0px 0}');
	document.writeln('-->');
	document.writeln('</style>');
//	window.alert("MacOS-9");

		function toggle_a_2() {

			var tog_form = document.getElementById("toggle_a_2");
			var tog_form_over = document.getElementById("toggle_a_2_over");
			//var tog_form3_over = document.getElementById("toggle_a_3_over");
			//var tog_form4_over = document.getElementById("toggle_a_4_over");

			tog_form.style.display = "block";
			tog_form_over.style.display = "none";
			//tog_form3_over.style.display = "none";
			//tog_form4_over.style.display = "none";
			
			var tag_1 = document.getElementById("tab_1");
			tag_1.style.paddingBottom = "3px";
						
			var tag_1_a = document.getElementById("tab_1_a");
			tag_1_a.style.color = "#333333";
			tag_1_a.style.background = "#FFFFFF";
			tag_1_a.style.textDecoration = "none";
			
			var tab_2 = document.getElementById("tab_2");
			tab_2.style.paddingBottom = "0px";

			var tag_2_a = document.getElementById("tab_2_a");
			tag_2_a.style.color = "#333333";
			tag_2_a.style.background = "#FFFFFF";
			tag_2_a.style.textDecoration = "underline";

			//var tab_3 = document.getElementById("tab_3");
			//tab_3.style.paddingBottom = "0px";

			//var tag_3_a = document.getElementById("tab_3_a");
		//	tag_3_a.style.color = "#FFFFFF";
			//tag_3_a.style.background = "#FF9933";
			//tag_3_a.style.textDecoration = "underline";

			//var tab_4 = document.getElementById("tab_4");
			//tab_4.style.paddingBottom = "0px";

			//var tag_4_a = document.getElementById("tab_4_a");
			//tag_4_a.style.color = "#FFFFFF";
			//tag_4_a.style.background = "#FF9933";
			//tag_4_a.style.textDecoration = "underline";
			
		}

		function toggle_a_2_over() {

			var tog_form = document.getElementById("toggle_a_2");
			var tog_form_over = document.getElementById("toggle_a_2_over");
			//var tog_form3_over = document.getElementById("toggle_a_3_over");
			//var tog_form4_over = document.getElementById("toggle_a_4_over");

			tog_form.style.display = "none";
			tog_form_over.style.display = "block";
			//tog_form3_over.style.display = "none";
			//tog_form4_over.style.display = "none";
	
			var tag_1 = document.getElementById("tab_1");
			tag_1.style.paddingBottom = "0px";
			
			var tag_1_a = document.getElementById("tab_1_a");
			tag_1_a.style.color = "#333333";
			tag_1_a.style.background = "#FFFFFF";
			tag_1_a.style.textDecoration = "underline";
	
			var tab_2 = document.getElementById("tab_2");
			tab_2.style.paddingBottom = "3px";
			
			var tag_2_a = document.getElementById("tab_2_a");
			tag_2_a.style.color = "#333333";
			tag_2_a.style.background = "#FFFFFF";
			tag_2_a.style.textDecoration = "none";
			
			//var tag_3 = document.getElementById("tab_3");
			//tag_3.style.paddingBottom = "0px";
			
			//var tag_3_a = document.getElementById("tab_3_a");
		//	tag_3_a.style.color = "#FFFFFF";
		//	tag_3_a.style.background = "#FF9933";
		//	tag_3_a.style.textDecoration = "underline";

			//var tag_4 = document.getElementById("tab_4");
			//tag_4.style.paddingBottom = "0px";
			
			//var tag_4_a = document.getElementById("tab_4_a");
			//tag_4_a.style.color = "#FFFFFF";
			//tag_4_a.style.background = "#FF9933";
			//tag_4_a.style.textDecoration = "underline";
			
		}

/*
		function toggle_a_3_over() {

			var tog_form = document.getElementById("toggle_a_2");
			var tog_form_over = document.getElementById("toggle_a_2_over");
			var tog_form3_over = document.getElementById("toggle_a_3_over");
			//var tog_form4_over = document.getElementById("toggle_a_4_over");

			tog_form.style.display = "none";
			tog_form_over.style.display = "none";
			tog_form3_over.style.display = "block";
			//tog_form4_over.style.display = "none";
	
			var tag_1 = document.getElementById("tab_1");
			tag_1.style.paddingBottom = "0px";
			
			var tag_1_a = document.getElementById("tab_1_a");
			tag_1_a.style.color = "#FFFFFF";
			tag_1_a.style.background = "#FF9933";
			tag_1_a.style.textDecoration = "underline";
	
			var tab_2 = document.getElementById("tab_2");
			tab_2.style.paddingBottom = "0px";
			
			var tag_2_a = document.getElementById("tab_2_a");
			tag_2_a.style.color = "#FFFFFF";
			tag_2_a.style.background = "#FF9933";
			tag_2_a.style.textDecoration = "underline";
			
			var tag_3 = document.getElementById("tab_3");
			tag_3.style.paddingBottom = "3px";
			
			var tag_3_a = document.getElementById("tab_3_a");
			tag_3_a.style.color = "#333333";
			tag_3_a.style.background = "#FFFFFF";
			tag_3_a.style.textDecoration = "none";

			//var tag_4 = document.getElementById("tab_4");
			//tag_4.style.paddingBottom = "0px";
			
			//var tag_4_a = document.getElementById("tab_4_a");
			//tag_4_a.style.color = "#FFFFFF";
			//tag_4_a.style.background = "#FF9933";
			//tag_4_a.style.textDecoration = "underline";
			
		}

		function toggle_a_4_over() {

			var tog_form = document.getElementById("toggle_a_2");
			var tog_form_over = document.getElementById("toggle_a_2_over");
			var tog_form3_over = document.getElementById("toggle_a_3_over");
			//var tog_form4_over = document.getElementById("toggle_a_4_over");

			tog_form.style.display = "none";
			tog_form_over.style.display = "none";
			tog_form3_over.style.display = "none";
			//tog_form4_over.style.display = "block";
	
			var tag_1 = document.getElementById("tab_1");
			tag_1.style.paddingBottom = "0px";
			
			var tag_1_a = document.getElementById("tab_1_a");
			tag_1_a.style.color = "#FFFFFF";
			tag_1_a.style.background = "#FF9933";
			tag_1_a.style.textDecoration = "underline";
	
			var tab_2 = document.getElementById("tab_2");
			tab_2.style.paddingBottom = "0px";
			
			var tag_2_a = document.getElementById("tab_2_a");
			tag_2_a.style.color = "#FFFFFF";
			tag_2_a.style.background = "#FF9933";
			tag_2_a.style.textDecoration = "underline";
			
			var tag_3 = document.getElementById("tab_3");
			tag_3.style.paddingBottom = "0px";
			
			var tag_3_a = document.getElementById("tab_3_a");
			tag_3_a.style.color = "#FFFFFF";
			tag_3_a.style.background = "#FF9933";
			tag_3_a.style.textDecoration = "underline";

			//var tag_4 = document.getElementById("tab_4");
			//tag_4.style.paddingBottom = "3px";
			
			//var tag_4_a = document.getElementById("tab_4_a");
			//tag_4_a.style.color = "#333333";
			//tag_4_a.style.background = "#FFFFFF";
			//tag_4_a.style.textDecoration = "none";
			
		}
*/
		
}





function wopen(){
window.open("popup.html","TT","toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=no,risizable=no,width=300,height=450");}

function MM_openBrWindow(theURL,winName,features) { window.open(theURL,winName,features);}

function RollOverImage(ID, VALUE){
document.getElementById(ID).setAttribute("src", VALUE);
}

function createXMLHttp() {
try {
	return new ActiveXObject("Microsoft.XMLHTTP");
	} catch(e) {
	try {
		return new XMLHttpRequest();
		} catch (e1) {
		return null;
		}
	}
	return null;
}

function getAjax(source) {
			
	var source;
	xmlhttp = createXMLHttp();
	
	if(xmlhttp){
		
		switch(source){
	
		case 'flash' :
		
			xmlhttp.onreadystatechange = float_window;
			xmlhttp.open('GET', 'form_flash.htm');
			xmlhttp.send(null);
			alert("pppp");
			break;
			
		case 'test' :
		
			xmlhttp.onreadystatechange = check_txt;
			xmlhttp.open('GET', 'data2.xml');
			xmlhttp.send(null);
			break;
			
		case 'binary' :

			xmlhttp.onreadystatechange = float_window;
			xmlhttp.open('GET', 'binary_list.xml');
			xmlhttp.send(null);
			break;
			
		case 'admin_binary' :
			xmlhttp.onreadystatechange = float_window;
			xmlhttp.open('GET', 'admin_binary_list.xml');
			xmlhttp.send(null);
			break;
			
		case 'html_ref' :
			xmlhttp.onreadystatechange = float_window;
			xmlhttp.open('GET', 'html_ref.xml');
			xmlhttp.send(null);
			break;
		}	

	} else {
		alert("XMLHttpRequest失敗");
	}
}

function float_window()
{
	if (xmlhttp.readyState == 4 && xmlhttp.status == 200){
	
		xmlDoc = xmlhttp.responseText;
		document.getElementById("float_window").innerHTML = xmlDoc;
		display_float_window();
	}
}

function display_float_window(htm)
{

	//if (document.getElementById && document.childNodes) {
		
	//	var obj = document.getElementById('float_window');
	//	obj.childNodes[0].nodeValue=htm;
	//}
		
	document.getElementById('float_window').style.visibility = 'visible';
	
}

function hide_float_window()
{
	document.getElementById('float_window').style.visibility = 'hidden';
	window.location.reload();
}

function hide_float_window_nonrefresh()
{
	document.getElementById('float_window').style.visibility = 'hidden';
//	window.location.reload();
}

function tools_DoFSCommand(command, args) {
	
	alert("HORHOR");

	var isInternetExplorer = navigator.appName.indexOf("Microsoft") != -1;
	var presenObj = isInternetExplorer ? document.all.presen : document.presen;

	if (command == "messagebox") {
		alert(args);
	} else if (command == "popup") {
		alert("AD");
	}

}

var article_toggleState = "0";
function toggleArticleForm() {
	
//	alert("a:"+article_toggleState);

	var tog_form = document.getElementById("toggle_a_2");
	var tog_form_over = document.getElementById("toggle_a_2_over");


	if(article_toggleState == "0") {
		tog_form.style.display = "block";
		tog_form_over.style.display = "none";
	} else {
		tog_form.style.display = "none";
		tog_form_over.style.display = "block";
	}
	
	article_toggleState = article_toggleState ^ 1;
	
//		alert("b:"+article_toggleState);

}





function del_video_preview() {
//	var b = document.getElementById('video_preview');
//	var d = document.getElementById('video_preview').lastChild;
//	b.removeChild(d);
	document.getElementById('video_preview').style.visibility = 'hidden';
}


function video_preview_on(file_name,evt){

	evt = (evt) ? evt : event;

	if(evt.pageX) {

		document.getElementById('video_preview').style.top = evt.pageY  + "px";
		document.getElementById('video_preview').style.left = evt.pageX +"px";		
	} else if(evt.clientX) {
		
		var temp_top, temp_left;
		

		temp_top = evt.clientY + document.body.scrollTop - document.body.clientTop;
		temp_left = evt.clientX + document.body.scrollLeft - document.body.clientLeft;
		
		var bodParent = document.body.parentElement;
		
		temp_top += bodParent.scrollTop - bodParent.clientTop;
		
		document.getElementById('video_preview').style.top = temp_top  + "px";
		document.getElementById('video_preview').style.left = temp_left +"px";
	}

	//document.getElementById('upload_preview').style.top = '300px';
	//document.getElementById('upload_preview').style.left =  '20px';

//var swf_html ='<strong>yES</strong>';


//var swf_html_1 ='<h1>PEACE</h1><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="320" height="240" id="skip" align="middle">';
//var swf_html_2 ='<param name="allowScriptAccess" value="sameDomain" />';
//var swf_html_3 ='<param name="movie" value="ball.swf" />';
//var swf_html_4 ='<param name="quality" value="high" />';
//var swf_html_5 ='<param name="bgcolor" value="#ffffff" />';
//var swf_html_6 ='<embed src="skip.swf" quality="high" bgcolor="#ffffff" width="320" height="240" name="skip" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" /></object>';
//var swf_html_7 = '<br /><a href="javascript:del_video_preview()">close</a>';

//var swf_html = swf_html_1 + swf_html_2 + swf_html_3 + swf_html_4 + swf_html_5 + swf_html_6 + swf_html_7;

//	document.getElementById('video_preview').style.visibility = 'visible';
//	var b = document.getElementById('video_preview');
//	b.innerHTML = swf_html;

//	f=document.createElement("img");
//	f.src = file_name;
//	f.style.cursor = 'pointer';
	//b.appendChild(f);
//	document.getElementById('video_preview').onmouseup = del_video_preview;

//getFlash_Video_pattern2();
document.getElementById('video_preview').style.visibility = 'visible';


}


function flv_window()
{


//	if (document.getElementById && document.childNodes) {
		
//		var obj = document.getElementById('flv_window');
//		obj.childNodes[0].nodeValue=htm;
//	}

/////


	
//	document.getElementById('flv_window').style.top = (document.body.clientHeight - document.getElementById('flv_window').offsetHeight)/2  + "px";
	document.getElementById('flv_window').style.left = (document.body.clientWidth - document.getElementById('flv_window').offsetWidth)/2 +"px";	
		
	document.getElementById('flv_window').style.visibility = 'visible';

}

function hide_flv_window_nonrefresh()
{
	document.getElementById('flv_window').style.visibility = 'hidden';
	window.location.reload();
}

function del_update_window() {
//	var b = document.getElementById('video_preview');
//	var d = document.getElementById('video_preview').lastChild;
//	b.removeChild(d);
	document.getElementById('update_window').style.visibility = 'hidden';
}


function update_window_on(file_name,evt){

	evt = (evt) ? evt : event;

	if(evt.pageX) {

		document.getElementById('update_window').style.top = evt.pageY  + "px";
		document.getElementById('update_window').style.left = evt.pageX +"px";		
	} else if(evt.clientX) {
		
		var temp_top, temp_left;
		

		temp_top = evt.clientY + document.body.scrollTop - document.body.clientTop;
		temp_left = evt.clientX + document.body.scrollLeft - document.body.clientLeft;
		
		var bodParent = document.body.parentElement;
		
		temp_top += bodParent.scrollTop - bodParent.clientTop;
		
		document.getElementById('update_window').style.top = temp_top  + "px";
		document.getElementById('update_window').style.left = temp_left +"px";
	}


document.getElementById('update_window').style.visibility = 'visible';


}

function basket_in_on(evt) {


	document.getElementById('basket_in').style.left = (document.body.clientWidth - document.getElementById('basket_in').offsetWidth)/2 +"px";
	document.getElementById('basket_in').style.top = (document.body.clientHeight/2) + "px";
	document.getElementById('basket_in').style.visibility = 'visible';



}

function del_basket_in() {

	document.getElementById('basket_in').style.visibility = 'hidden';
}
