var openType = 1;
var checkArea = '';
var exclusionStr = new Array('.aspx','@','script','jpg','aboutul','http://www.line.co.jp/','http://www.lineseiki.ru/');
var inclusionClassName = 'nw';
var anchorObject = '<img src="http://www.lineseiki.com/editorfiles/pdf.gif" width="24" height="11" alt="The link is opened in a new window." title="The link is opened in a new window." />';


var isIE = (document.documentElement.getAttribute("style") == document.documentElement.style);

function newWin(){
	if(checkArea == ''){
		var anchors = document.getElementsByTagName('a');
	}else{
		var anchors = document.getElementById(checkArea).getElementsByTagName('a');
	}
	for(i = 0; i < anchors.length; i++){
		var exNum = 0;
		var anchor = anchors[i];
		var aInner = anchor.innerHTML;
		var ahref = anchor.href;
		if(aInner.indexOf('<img') == -1){
			for(j = 0; j < exclusionStr.length; j++){
				eAnchor = exclusionStr[j];
				if((ahref.indexOf(eAnchor) == -1 || anchor.className == inclusionClassName) & anchor.href != ''){
					exNum++;
				}
			}
			if(exNum ==  exclusionStr.length){
				var winAnchor = document.createElement('a');
				winAnchor.innerHTML = anchorObject;
				winAnchor.href = anchor.href;
				winAnchor.className = 'newWin';
				if(openType == 1){
					winAnchor.setAttribute('target','_blank');
				}else if(openType == 2){
					if(isIE) {
						winAnchor.setAttribute('onclick',new Function('window.open(this.href,\'\',\'status=yes,scrollbars=yes,directories=yes,menubar=yes,resizable=yes,toolbar=yes\'); return false;'));
					}else{
						winAnchor.setAttribute('onclick','window.open(this.href,\'\',\'status=yes,scrollbars=yes,directories=yes,menubar=yes,resizable=yes,toolbar=yes\'); return false;');
					}
				}
				anchor.parentNode.insertBefore(winAnchor,anchor);
				anchor.parentNode.replaceChild(winAnchor,anchor);
				winAnchor.parentNode.insertBefore(anchor,winAnchor);
				var i = i + 1;
			}
		}
	}
}

