/* TARGET BLANK ---------------------------------------------*/
function externalLinks() {
	if (!document.getElementsByTagName) return;
	var anchors = document.getElementsByTagName("a");
	for (var i=0; i<anchors.length; i++) {
	var anchor = anchors[i];
	if (anchor.getAttribute("href") &&
		anchor.getAttribute("rel") == "external")
		anchor.target = "_blank";
	}
}

window.onload = externalLinks;


/* POPUP ---------------------------------------------*/
var wProHeight = new Array();
wProHeight = [0,680,659,570];
function openBeautyWin(wUrl){
	wWidth = 1100;
	wHeight = 680;
	scWidthCenter = screen.availWidth / 2;
	scHeightCenter = screen.availHeight / 2;
	wOption = "toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=" + wWidth + ",height=" + wHeight + ",left=" + (scWidthCenter - (wWidth / 2)) + ",top=" + (scHeightCenter - (wHeight / 2));
	sWinName = "Beauty";
	wObj = window.open(wUrl,sWinName,wOption);
	wObj.focus();
}

function changeParURL(wUrl){
	bCheck = CheckParWin();
	if(bCheck){
		window.opener.focus();
		window.opener.location.href = wUrl;
	}else{
		openMainWin(wUrl);
	}
}


/* WINDOW CHANGE ---------------------------------------------*/

function CheckParWin(){
	if ((navigator.userAgent.indexOf("Mac") > -1)){
		if (window.opener){
			bOpen = true;
		}else{
			bOpen = false;
		}
	}else{
		if(OSFlag == "WinNN4"){
			if (!window.opener.closed){
				bOpen = true;
			}else{
				bOpen = false;
			}
		}else{
			if (window.opener&&!window.opener.closed){
				bOpen = true;
			}else{
				bOpen = false;
			}
		}
	}
	return bOpen;
}


var Appversion = navigator.appVersion.charAt(0);
var Appname = navigator.appName.charAt(0);
var OSFlag;
with( document ){
	if(navigator.appVersion.indexOf("Mac") > -1){
		if( Appname == "M" ){
			//  MAC IE
			OSFlag = "MacIE"
		}
		else{
			if( Appversion < 5 ){
				//  MAC NN 4.x
				OSFlag = "MacNN4"
		 	}else{
				//  MAC NN 7.x
				OSFlag = "MacNN7"
		 	}
		 }
	}
	else{
		if( Appname == "M" ){
			//  WIN IE
			OSFlag = "WinIE"
		}
		else{
			if( Appversion < 5 ){
				//  WIN NN 4.x
				OSFlag = "WinNN4"
			}else{
				//  WIN NN 7.x
				OSFlag = "WinNN7"
			}
		}
	}
}


/* POPUP WINDOW ---------------------------------------------*/

function openLinkPopup(wUrl,wWidth,wHeight){
	var wObj;
//	wWidth = 650;
//	wHeight = 600;

	var winName = 'LorealParis';
	scWidthCenter = screen.availWidth / 2;
	scHeightCenter = screen.availHeight / 2;
	wOption =
	"toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width="
	+ wWidth + ",height=" + wHeight + ",left=" + (scWidthCenter - (wWidth /
	2)) + ",top=" + (scHeightCenter - (wHeight / 2));
	wObj = window.open(wUrl,winName,wOption);
	wObj.focus();
}
