var j$ = jQuery;

j$(function(){
	j$("#maincontainer a",this).each(function(){
		if(j$(this).attr("href") != undefined && !j$(this).is(":has('img')")){
			var $this = j$(this);
			if($this.attr("href").match(".pdf$")){
				if($this.css("display") == 'block'){
					$this.append("<img src='/imgs/common/ic_pdf.gif' width='11' height='11' class='icon' />");
				}else{
					$this.after("<img src='/imgs/common/ic_pdf.gif' width='11' height='11' class='icon' />");
				}
			}else if($this.attr("href").match(".doc$") || $this.attr("href").match(".docx$")){
				if($this.css("display") == 'block'){
					$this.append("<img src='/imgs/common/ic_word.gif' width='11' height='11' class='icon' />");
				}else{
					$this.after("<img src='/imgs/common/ic_word.gif' width='11' height='11' class='icon' />");
				}
			}else if($this.attr("href").match(".xls$") || $this.attr("href").match(".xlsx$")){
				if($this.css("display") == 'block'){
					$this.append("<img src='/imgs/common/ic_excel.gif' width='13' height='11' class='icon' />");
				}else{
					$this.after("<img src='/imgs/common/ic_excel.gif' width='13' height='11' class='icon' />");
				}
			}else if($this.attr("target") == "_blank"){
				if($this.css("display") == 'block'){
					$this.append("<img src='/imgs/common/ic_newwin.gif' width='13' height='11' class='icon' />");
				}else{
					$this.after("<img src='/imgs/common/ic_newwin.gif' width='13' height='11' class='icon' />");
				}
			}
		}
	});
});

//pulldown
j$("#glovalnavi li").hover(function(){
	j$("#glovalnavi li dl  dd  a",this).each(function(){
		if(j$(this).attr("href") != undefined && !j$(this).is(":has('img')")){
			var $this = j$(this);
			if($this.attr("href").match(".pdf$")){
				if($this.css("display") == 'block'){
					$this.append("<img src='/imgs/common/ic_pdf.gif' width='11' height='11' class='icon' />");
				}else{
					$this.after("<img src='/imgs/common/ic_pdf.gif' width='11' height='11' class='icon' />");
				}
			}else if($this.attr("href").match(".doc$") || $this.attr("href").match(".docx$")){
				if($this.css("display") == 'block'){
					$this.append("<img src='/imgs/common/ic_word.gif' width='11' height='11' class='icon' />");
				}else{
					$this.after("<img src='/imgs/common/ic_word.gif' width='11' height='11' class='icon' />");
				}
			}else if($this.attr("href").match(".xls$") || $this.attr("href").match(".xlsx$")){
				if($this.css("display") == 'block'){
					$this.append("<img src='/imgs/common/ic_excel.gif' width='13' height='11' class='icon' />");
				}else{
					$this.after("<img src='/imgs/common/ic_excel.gif' width='13' height='11' class='icon' />");
				}
			}else if($this.attr("target") == "_blank"){
				if($this.css("display") == 'block'){
					$this.append("<img src='/imgs/common/ic_newwin.gif' width='13' height='11' class='icon' />");
				}else{
					$this.after("<img src='/imgs/common/ic_newwin.gif' width='13' height='11' class='icon' />");
				}
			}
		}
	});
});

//toppage
j$(function(){
	j$("#top-contenets a",this).each(function(){
		if(j$(this).attr("href") != undefined && !j$(this).is(":has('img')")){
			var $this = j$(this);
			if($this.attr("href").match(".pdf$")){
				if($this.css("display") == 'block'){
					$this.append("<img src='/imgs/common/ic_pdf.gif' width='11' height='11' class='icon' />");
				}else{
					$this.after("<img src='/imgs/common/ic_pdf.gif' width='11' height='11' class='icon' />");
				}
			}else if($this.attr("href").match(".doc$") || $this.attr("href").match(".docx$")){
				if($this.css("display") == 'block'){
					$this.append("<img src='/imgs/common/ic_word.gif' width='11' height='11' class='icon' />");
				}else{
					$this.after("<img src='/imgs/common/ic_word.gif' width='11' height='11' class='icon' />");
				}
			}else if($this.attr("href").match(".xls$") || $this.attr("href").match(".xlsx$")){
				if($this.css("display") == 'block'){
					$this.append("<img src='/imgs/common/ic_excel.gif' width='13' height='11' class='icon' />");
				}else{
					$this.after("<img src='/imgs/common/ic_excel.gif' width='13' height='11' class='icon' />");
				}
			}else if($this.attr("target") == "_blank"){
				if($this.css("display") == 'block'){
					$this.append("<img src='/imgs/common/ic_newwin.gif' width='13' height='11' class='icon' />");
				}else{
					$this.after("<img src='/imgs/common/ic_newwin.gif' width='13' height='11' class='icon' />");
				}
			}
		}
	});
});