//*************************************************************************************************
function openPrintWindow(){
//*************************************************************************************************
    window.open(window.location.href,"printWindow");
}

if(window.name == "printWindow"){
	document.write('<link rel="stylesheet" type="text/css" href="' + getRelatedPath() + 'styles/print.css" media="all" />');
}

function printReady(){
	var tagsLi;
	tagsLi = document.getElementsByTagName("LI");
	for(var i=0; i<=tagsLi.length-1; i++){
		if(tagsLi[i].style.backgroundImage != ""){
			var strUrl = tagsLi[i].style.backgroundImage.substring(4, tagsLi[i].style.backgroundImage.length-1);
			setImgTag(tagsLi[i], strUrl);
			tagsLi[i].style.backgroundImage = "";
		}
	}

	tagsUl = document.getElementsByTagName("UL");
	for(var i=0; i<=tagsUl.length-1; i++){
		var strUrl = "";
		switch(tagsUl[i].className){
			case "sub_bull":
				strUrl = getRelatedPath() + "fontimages/souni/souni_e3d0.png";
				break;
			case "step_bull":
			strUrl = getRelatedPath() + "fontimages/souni/souni_e3d0.png";
				break;
			case "table_b_bull":
				strUrl = getRelatedPath() + "fontimages/souni/souni_e3d0.png";
				break;
			case "sub_hyph":
				strUrl = getRelatedPath() + "fontimages/souni/souni_e215.png";
				break;
			case "ts_a":
				strUrl = getRelatedPath() + "fontimages/souni/souni_e3d0.png";
				break;
			case "ts_arrow":
				strUrl = getRelatedPath() + "fontimages/souni/souni_e173.png";
				break;
			default:
				break;
		}
		if(strUrl != ""){
			if(UseIE){
				if(tagsUl[i].childNodes[0].childNodes[0] != null){
					if(tagsUl[i].childNodes[0].childNodes[0].tagName == "P"){
						setImgTag(tagsUl[i].childNodes[0], strUrl);
					}else{
						setImgTag(tagsUl[i].childNodes[0].childNodes[0], strUrl);
					}
				}
			}else{
				if(tagsUl[i].childNodes[1].childNodes[1].tagName == "P"){
					setImgTag(tagsUl[i].childNodes[1], strUrl);
				}else{
					setImgTag(tagsUl[i].childNodes[1].childNodes[1], strUrl);
				}
			}
		}
	}

	tagsDiv = document.getElementsByTagName("DIV");
	for(var i=0; i<=tagsDiv.length-1; i++){
		var strUrl = "";
		switch(tagsDiv[i].className){
			case "link_list":
				strUrl = getRelatedPath() + "images/s3010.gif";
				break;
			default:
				break;
		}
		if(strUrl != ""){
			setImgTag(tagsDiv[i], strUrl);
		}
	}
}

function setImgTag(eSrc, url){
	if(UseIE){
		eSrc.childNodes[0].insertAdjacentHTML("afterBegin", "<img src='"+url+"' />&nbsp;");
	}else{
		eSrc.childNodes[1].innerHTML = "<img src='"+url+"' />&nbsp;" + eSrc.childNodes[1].innerHTML;
	}
}

function getRelatedPath(){
	var relatedPath = "";
	var contentPath = document.location.href;
	var classes;

	if(contentPath.indexOf("contents/") != -1){
		contentPath = contentPath.substr(contentPath.indexOf("contents/")+"contents/".length, contentPath.length);

		if(contentPath.indexOf("#") != -1){
			contentPath = contentPath.substr(0, contentPath.lastIndexOf("#"));
		}

		classes = contentPath.split("/").length - 1;
		for(counter = 0; counter < classes; counter++){
			relatedPath += "../";
		}
		relatedPath += "common/";

	}else{
		relatedPath = "contents/common/";

	}

	return relatedPath;
}
