var isNN = (navigator.appName.indexOf('Netscape') != -1);
var isIE = (navigator.appName.indexOf('Microsoft') != -1);

var browser = "";
if (navigator.userAgent.toLowerCase().indexOf('msie') != -1) browser = "_ie";

var isEng = (location.toString().toLowerCase().indexOf('langno=1') != -1 || location.toString().toLowerCase().indexOf('index_tc') == -1)
var sPath = "EN";
if (!isEng) sPath = "TC"

function SetCSS()
{
	if (location.toString().toLowerCase().indexOf('/wcms/') == -1)
	document.write('<LINK href="/templates/' + sPath + '/css/cybershop' + browser + '.css" type=text/css rel=stylesheet>');
}

function AddCSS(sInCSSName)
{
	if (location.toString().toLowerCase().indexOf('/wcms/') == -1)
	document.write('<LINK href="/templates/' + sPath + '/css/' + sInCSSName + browser + '.css" type=text/css rel=stylesheet>');
}

function SwitchLang()
{
	if (isEng)
		location = location.toString().replace('langNo=1', 'langNo=2').replace('/index', '/index_tc');
	else
		location = location.toString().replace('langNo=2', 'langNo=1').replace('/index_tc', '/index');
}

function PrintCopyRight()
{
	if (location.toString().toLowerCase().indexOf('/wcms/') == -1)
	document.write("&co"+"py;");
}

function AddToFavourites()
{
	title = "CyberShopping";
	url = location.toString();
	if (window.sidebar)
	{
		 window.sidebar.addPanel(title, url,"");
	} else if( window.external )
	{
		window.external.AddFavorite( url, title);
	}
}

function merchantwin(url) {
	var filePath = '/FileManager/EN/UTIL_UTEMPLATE/cybershop/cs_merchant_tp.htm';
	var features = 'scrollbars,status,location,menubar,toolbar';
	var adjWidth = screen.availWidth - 10;
	var adjHeight = screen.availHeight - 160;
	features += ',width=' + adjWidth + ',height=' + adjHeight;

	if (isIE)
		features += ',left=0,top=0';
	else
		features += ',screenX=0,screenY=0';
		
	if (!isEng)
		filePath = filePath.replace('/EN/', '/TC/');

	shopwin = window.open('','',features);
	shopwin.document.writeln('<html><head><title>CyberShopping</title></head>');
	shopwin.document.writeln('<frameset rows="65,100%" cols="*" border="1" framespacing="1"> ');
	shopwin.document.writeln('  <frame src="' + filePath + '" noresize scrolling="NO" name="topframe">');
	shopwin.document.writeln('	<frame src="' + url + '" marginwidth="0" marginheight="0" name="cscontent" frameborder="NO">');
	shopwin.document.writeln('</frameset>');
	shopwin.document.writeln('<noframes><body bgcolor="#FFFFFF" text="#000000"></body></noframes>');
	shopwin.document.writeln('</html>');
	shopwin.document.close();
}
