// JavaScript Document
function addLoadEvent(func){
	var oldonload = window.onload;
	
	if(typeof window.onload != 'function'){
		window.onload = func;
		
	}else{
		window.onload = function(){
			oldonload();
			func();
		}
	}
}

/* quick */
function CheckUIElements(){

	var yMenuFrom, yMenuTo, timeoutNextCheck, speed;

	yMenuFrom = parseInt(document.getElementById("quick").style.top, 10);
	yMenuTo = 190 + parseInt(document.documentElement.scrollTop, 10);

	timeoutNextCheck = 400;

	if(yMenuFrom == yMenuTo){
		setTimeout ("CheckUIElements()", timeoutNextCheck);
		return false;
		
	}else{
		speed = Math.ceil((yMenuTo - yMenuFrom) * 0.1);

		document.getElementById("quick").style.top = (parseInt(document.getElementById("quick").style.top, 10) + speed) + "px";
		timeoutNextCheck = 10;

		setTimeout ("CheckUIElements()", timeoutNextCheck);
		return false;
	}

}


function quick_onLoad(){
	if(!document.getElementById("quick")) return false;
	var start_pos = parseInt(document.getElementById("quick").style.top, 10);
	document.getElementById("quick").style.top = start_pos + "px";
	document.getElementById("quick").style.display = "block";
	CheckUIElements();
	
}
addLoadEvent(quick_onLoad);


/* Image Menu on/off */
function imgOn(imgEl)
{
	imgEl.src = imgEl.src.replace("_off.gif", "_on.gif");
}
function imgOut(imgEl)
{
	imgEl.src = imgEl.src.replace("_on.gif", "_off.gif");
}
function imgOn0(imgEl)
{
	imgEl.src = imgEl.src.replace("_off.gif", "_on.jpg");
}

function imgOut0(imgEl)
{
	imgEl.src = imgEl.src.replace("_on.jpg", "_off.gif");
}


/* history */

function fild_btn(no) {
	var num = no;

	document.getElementById("history_01").style.display = 'none';
	document.getElementById("history_02").style.display = 'none';
	document.getElementById("history_03").style.display = 'none';
	document.getElementById("history_04").style.display = 'none';
	document.getElementById("history_05").style.display = 'none';
	
	document.getElementById(["history_0"+num]).style.display = "block";
}


//   ////////////////////////////		½ºÅ©·Ñ			///////////////////////////
var rotation = false;
var content_height = 0;
var content_mv = 0;

function mousePosition(evnt){
	var theEvent = evnt ? evnt : window.event;
	var theSrc = theEvent.target ? theEvent.target : theEvent.srcElement;
	
	if(rotation == false) return false;
//	if(theSrc.nodeName != "img") return false;
//	scrollarea
	
	scrollimg_top = event.clientY + document.documentElement.scrollTop - 310;
	if(scrollimg_top<0) scrollimg_top =0;
	if(scrollimg_top>375) scrollimg_top =375;
	
	if(scrollimg_top>=0 &&  scrollimg_top<=380) {
		document.getElementById("scrollimg").style.top = scrollimg_top + "px";
		
		content_top = scrollimg_top * content_mv;
		document.getElementById("scrollarea").style.top = -content_top + "px";
	
	//document.getElementById("result").innerHTML = 
	//		"¸¶¿ì½ºYÁÂÇ¥ = " + event.clientY
	//		+ "<br />ÀÌ¹ÌÁöÀ§Ä¡    = " + scrollimg_top
	//        + "<br />ÄÜÅÙÃ÷ À§Ä¡    = " + (content_top)
	//        + "<br />ÄÜÅÙÃ÷ Ç¥½ÃÅ©±â    = " + (content_height - 380)
	//        + "<br />ÄÜÅÙÃ÷ Å©±â    = " + content_height;
	}
}

function scroll_mouseDown(img_self){
	rotation = true;
	if(!document.getElementById("scrollarea")) return false;;
	content_height = document.getElementById("scrollarea").offsetHeight;
	if(content_height>380) { //³»¿ëÀÌ ÀÛÀº°æ¿ì ½ºÅ©·Ñ ¸·À½ 
		content_mv=(content_height - 390) / 380;
	}
	this.focus();
}

function scroll_mouseUp(){
	rotation = false;
	document.onmousemove = null;
}
function scroll_start(){
	if(!document.getElementById("scrollimg")) return false;
	document.onmousemove = mousePosition;
}
document.onmousedown = scroll_start;
document.onmouseup = scroll_mouseUp;

function scroll_onload(){
	if(!document.getElementById("scrollarea")) return false;
	if(!document.getElementById("scrollimg")) return false;
	content_height = document.getElementById("scrollarea").offsetHeight;
	if(content_height>410) { //³»¿ëÀÌ ÀÛÀº°æ¿ì ½ºÅ©·Ñ ¸·À½ 
		document.getElementById("scrollimg").style.display = "block";
	}else{
		document.getElementById("scrollimg").style.display = "none";
	}
}
addLoadEvent(scroll_onload);


function popSuc(no) {	
   window.open("./popup_inquiry.asp?no="+no,"win","width=500,height=450,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,top=100,left=200");
}

function popData() {	
   window.open("../bbs/popup_data.asp","winindex","width=500,height=450,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,top=100,left=200");
}

/* product menu */
function product_tab(no) {
	var num = no;

	if(document.getElementById("contens01")){	document.getElementById("contens01").style.display = 'none';	}
	if(document.getElementById("contens02")){	document.getElementById("contens02").style.display = 'none';	}
	if(document.getElementById("contens03")){	document.getElementById("contens03").style.display = 'none';	}
	if(document.getElementById("contens04")){	document.getElementById("contens04").style.display = 'none';	}
	if(document.getElementById("contens05")){	document.getElementById("contens05").style.display = 'none';	}
	if(document.getElementById("scrollimg")){	document.getElementById("scrollimg").style.top = "0px"	}
	if(document.getElementById("scrollarea")){
		document.getElementById("scrollarea").style.top = "0px"
	}
	if (!document.getElementById("contens06"))
	{
		return false;
	}
	else 
	{
		document.getElementById("contens06").style.display = 'none';
	}
	
	document.getElementById(["contens0"+num]).style.display = "";
	document.getElementById(["contens0"+num]).style.float = "left";
	
	if(!document.getElementById("scrollarea")) return false;;
	content_height = document.getElementById("scrollarea").offsetHeight;
	if(content_height>410) { //³»¿ëÀÌ ÀÛÀº°æ¿ì ½ºÅ©·Ñ ¸·À½ 
		document.getElementById("scrollimg").style.display = "block";
	}else{
		document.getElementById("scrollimg").style.display = "none";
	}
	
}

function history_tab(no) {
	var num = no;

	document.getElementById("history_01").style.display = 'none';
	document.getElementById("history_02").style.display = 'none';
	document.getElementById("history_03").style.display = 'none';
	document.getElementById("history_04").style.display = 'none';
	document.getElementById("history_05").style.display = 'none';

	document.getElementById(["history_0"+num]).style.display = "block";
}



function succes_main_display(no) {
	var num = no;

	document.getElementById("succes_main01").style.display = 'none';
	document.getElementById("succes_main02").style.display = 'none';

	document.getElementById(["succes_main0"+num]).style.display = "block";
}
function succes_main(){
	if(!document.getElementById("succes_main")) return false;
	var target = document.getElementById("succes_main");
	var source = target.getElementsByTagName("img");
	var activeNum = source[source.length];
	
	for(i=0; i<source.length; i++){
		source[i].onclick = function(){
			for(j=0; j<source.length; j++){
				source[j].src = source[j].src.replace("_on", "_off");
				activeNum = this;
			}
			this.src = this.src.replace("_off", "_on");
		} // end of onclick
		
		source[i].onmouseout = function(){
			for(j=0; j<source.length; j++){
				if(activeNum != this){
					this.src = this.src.replace("_on", "_off");
				}
			}
		} // end of onmouseover
		source[i].onmouseover = function(){
			for(j=0; j<source.length; j++){
				if(activeNum != this){
					this.src = this.src.replace("_off", "_on");
				}
			}
		} // end of onmouseover
		
	} // end of for
}

addLoadEvent(succes_main);


function cwin(url1, w, h,idx) {
	
	w = parseInt(w);
	h = parseInt(h);
	
	var url = url1.getAttribute("href");
	if (screen.width < 1025){
		var LeftPosition=0;
		var TopPosition=0;
	} else {
		var LeftPosition=(screen.availWidth)?(screen.availWidth -w)/2:100;
		var TopPosition=(screen.availWidth )?(screen.availWidth -h)/2:100;
	}
	
	TopPosition = screen.availWidth/2 - w/2 - 100;
	LeftPosition = screen.availHeight/2 - h/2 - 0;
	
	window.open(url, idx, "width="+w+", height="+h+"px, top="+TopPosition+"px, left="+LeftPosition+"px, scrollbars=auto, resizable=yes");
}


// ///////////////////////    ÇÁ¸°Æ® ÆäÀÌÁö,,//////////////////////////
var printPopup_url = "";

function printpage(target) {
	// parget = product/nanotrack_03.asp;
	target = target;
	window.open("../print_page.html?'"+target+"'", "_blink", 'height=500, width=710 , scrollbars=yes, toolbar=nonoresizable,status=no,directory=no');

	printPopup_url = target;
}
// addLoadEvent(display_none);
function display_none(){
	if(document.getElementById("header")){
		document.getElementById("header").style.display = 'none';
	}
	if(document.getElementById("wrap")){
		document.getElementById("wrap").style.background = 'none';
	}
	if(document.getElementById("container_left")){
		document.getElementById("container_left").style.display = 'none';
	}
	if(document.getElementById("footer")){
		document.getElementById("footer").style.display = 'none';
	}
	if(document.getElementById("quick")){
		document.getElementById("quick").style.display = 'none';
	}
	if(document.getElementById("contents_top")){
		document.getElementById("contents_top").style.display = 'none';
	}
	if(document.getElementById("contents")){
		document.getElementById("contents").style.background = 'none';
	}
	if(document.getElementById("wrap")){
		document.getElementById("wrap").style.width = "671px";
	}
	
	document.body.style.background = 'none';

	if(document.getElementById("H2_2")){
		document.getElementById("H2_2").style.display = 'none';	
	}
	if(document.getElementById("H2_3")){
		document.getElementById("H2_3").style.display = 'inline';
	}

	if(document.getElementById("display_btn02")){
		document.getElementById("display_btn02").style.display = 'none';
	}

	if (!document.getElementById("scrollarea"))
	{
		return false
	}
	else
	{
		if(document.getElementById("sub_tab")){
			document.getElementById("sub_tab").style.display = 'none';
		}
		if(document.getElementById("scroll")){
			document.getElementById("scroll").style.display = 'none';
		}
		if(document.getElementById("contens01")){
			document.getElementById("contens01").style.display = 'block';
			document.getElementById("contens01").style.marginBottom = "30px";
		}
		if(document.getElementById("contens02")){
			document.getElementById("contens02").style.display = 'block';
			document.getElementById("contens02").style.marginBottom = "30px";
		}
		if(document.getElementById("contens03")){
			document.getElementById("contens03").style.display = 'block';
			document.getElementById("contens03").style.marginBottom = "30px";
		}
		if(document.getElementById("contens04")){
			document.getElementById("contens04").style.display = 'block';
			document.getElementById("contens04").style.marginBottom = "30px";
		}
		if(document.getElementById("contens05")){
			document.getElementById("contens05").style.display = 'block';
			document.getElementById("contens05").style.marginBottom = "30px";
		}
		if(document.getElementById("contens06")){
			document.getElementById("contens06").style.display = 'block';
                        document.getElementById("contens06").style.marginBottom = "30px";
		}
		
		if(document.getElementById("contens07")){
			document.getElementById("contens07").style.display = 'block';
                        document.getElementById("contens07").style.marginBottom = "30px";
		}
		if(document.getElementById("textarea")){
			document.getElementById("textarea").style.overflow = "visible";
			content_height = document.getElementById("scrollarea").offsetHeight;
			document.getElementById("textarea").style.height = content_height ;
		}
		
		if(document.getElementById("contents_start")){
			document.getElementById("contents_start").style.height = content_height;
		}
	}

	//document.getElementById("container").style.width = "";
	return;
}

/* ÆË¾÷ ÀÎ¼âÆäÀÌÁö Å¬¸¯½Ã ÇÁ¸°Æ® ¹öÆ° */
function btn_delete(){
	if(document.getElementById("H2_3")){
		document.getElementById("H2_3").style.display = 'none';
	}
	this.print();
	window.self.close();
}


function print_select(){
	paramExpressions = window.location.search.slice(2, 11).split("?");
	if (paramExpressions != "products/") //Á¦Ç° ÀÎ¼âÇÏ±â ÀÌ¿ÜÀÇ °Í È®ÀÎÇÏ±â    industrie  
	{
		return;
	}
	else 
	{
		display_none();
		return false
	}

}

function print_select01(){
	
//	paramExpressions = window.location.search.slice(2, -1).split("?");
//	if (paramExpressions == "0")

	paramExpressions = window.location.search.slice(2, 11).split("?");
	if(paramExpressions != "industrie")
	{
		return;
	}
	else 
	{
		if(document.getElementById("display_btn02")){
			document.getElementById("display_btn02").style.display = 'none';
		}
		if(document.getElementById("display_bt_area")){
			document.getElementById("display_bt_area").style.display = 'none';
		}
		display_none();
		return false
	}
}

function print_select02(){
	paramExpressions02 = window.location.search.slice(2, 9).split("?");
	if(paramExpressions02 != "success")
	{
		return;
	}
	else 
	{
		if(document.getElementById("ask_btn")){
			document.getElementById("ask_btn").style.display = 'none';
		}
		display_none();
		return false
	}
}
addLoadEvent(print_select);
addLoadEvent(print_select01);
addLoadEvent(print_select02);

