//

function correctView(parentURL)
{
	currentURL = parent.location.href;
	hostName = currentURL.substring(7,currentURL.indexOf('/',8));
	
	if (hostName == "www.biotech.co.th" || hostName == "www.fibertech.co.th")
	{
		if (currentURL != parentURL)
		{
	 		if(navigator.appName == "Microsoft Internet Explorer" || navigator.appName == "Netscape") 
	 		{
				parent.location.replace(parentURL);
			}
		}
	}
}

function openExternal(Title,Source,URL) 
{ 
	Page = "http://www.biotech.co.th/thai/external/index.asp?title=" + Title + "&url=" + URL + "&Source=" + Source;
	External = window.open(Page,"External",'status=1,menubar=0,resizable=1,toolbar=0,scrollbars=1,location=0,width=800,height=600,top=' + (screen.height-600)/2 + ',left=' + (screen.width-800)/2);
	External.focus();
}
	
function joinNewsletter(Lang,Email)
{
	url = '/'+Lang+'/newsletter/index.asp?email='+ Email;
		Newsletter = window.open(url,"Newsletter",'status=1,resizable=0,toolbar=0,scrollbars=0,width=260,height=453,top='+(screen.height-453)/2+ ',left=' + (screen.width-260-8)/2);
	Newsletter.focus();
}

function mapTo(URL)
{
	if(opener.closed)	{
		newPage=window.open(URL,"FromMap",'status=1,menubar=1,resizable=1,toolbar=1,scrollbars=1,location=1,width='+screen.width+',height='+screen.height);
		opener.name = "FromMap";
    		self.focus();
	}else
	{
		opener.top.location.href = URL;
	}
}



function openInfo(Page,Lang) 
{ 
	url = "/"+Lang+"/information/" + Page + "";
	Info = window.open(url,"Info",'resizable=0,toolbar=0,scrollbars=1,status=0,width=461,height=420,top=' + (screen.height-420)/2 + ',left=' + (screen.width-462)/2);
	Info.focus();
}

function openSitemap(Lang) 
{ 
	url = "/"+Lang+"/information/sitemap";
	Sitemap = window.open(url,"Sitemap",'status=0,resizable=0,toolbar=0,scrollbars=0,width=187,height=538,top=0' + ',left=' + (screen.width-187));
	Sitemap.focus();
}

function openProduct(Page,Lang,Center) 
{ 
	if (Page == 'F' || Page == 'FX' || Page == 'GX' || Page == 'AP' || Page == 'WB' || Page == 'BW') {Type='storage';} else {Type='treatment';}
	if (Center == '1') {AddHeight=70;AddWidth=165;} else {AddHeight=0;AddWidth=0;}
	url = "/" +Lang+"/products/"+Type+"/"+Page+"/feature.asp?noheader=1";
	Product = window.open(url,Page,'resizable=0,toolbar=0,scrollbars=0,width=530,height=420,top=' + (screen.height-420+AddHeight)/2 + ',left=' + (screen.width-530-8+AddWidth)/2);
	Product.focus();
}

function openProductGuide(Page,Lang) 
{ 
	url = "/" +Lang+"/products/" + Page + "/guide.asp";
	ProductGuide = window.open(url,Page,'border=0,status=0,resizable=0,toolbar=0,scrollbars=0,width=680,height=500,top=' + (screen.height-500)/2 + ',left=' + (screen.width-680)/2);
	ProductGuide.focus();
}

function openCustomized(Page,Lang) 
{ 
	url = "/"+Lang+"/products/customized/"+Page + "/";
	Project = window.open(url,'Project','resizable=0,toolbar=0,scrollbars=0,width=475,height=316,top=' + (screen.height-316)/2 + ',left=' + (screen.width-482-8)/2);
	Project.focus();
}

function openProject(Page,Lang) 
{ 
	url = "/"+Lang+"/company/experience/"+Page + "/";
	Project = window.open(url,'Project','status=1,resizable=0,toolbar=0,scrollbars=0,width=720,height=335,top=' + (screen.height-335)/2 + ',left=' + (screen.width-720-8)/2);
	Project.focus();
}

function openCertificate() 
{ 
	url = "http://www.biotech.co.th/images/company/certification/ISO-Certificate-2007.gif";
	Certificate = window.open(url,'Certificate','resizable=0,toolbar=0,scrollbars=0,width=420,height=570,top=' + (screen.height-643)/2 + ',left=' + (screen.width-475)/2);
	Certificate.focus();
}

function openFactory(Page,Lang) 
{ 
	url = "/" +Lang+"/company/factory/"+Page+"/index.asp";
	Factory = window.open(url,Page,'status=1,resizable=0,toolbar=0,scrollbars=0,width=720,height=335,top=' + (screen.height-335)/2 + ',left=' + (screen.width-720-8)/2);
	Factory.focus();
}

function openApplication(Pos)
{ 
	url = "http://www.biotech.co.th/thai/company/jobs/login.asp?Pos=" + Pos;
	Application=window.open(url,'Application','status=1,resizable=0,toolbar=0,scrollbars=1,width=650,height=470,top=' + (screen.height-470)/2 + ',left=' + (screen.width-650)/2);
	Application.focus()
}

function openMap(Lang,Refresh)
{ 
	url = "/"+Lang+"/contact/map.asp"
	Map=window.open(url,'Map','status=0,resizable=0,toolbar=0,scrollbars=0,width=604,height=244,top=' + (screen.height-244)/2 + ',left=' + (screen.width-604)/2);
	if (Refresh!='no') {self.location.reload();}
	Map.focus();
}

function newPage(URL)
{
	Name = 'P'+Math.floor(100*Math.random())+'';
	newPage=window.open(URL,Name,'status=1,menubar=1,resizable=1,toolbar=1,scrollbars=1,location=1,width=800,height=500,top=' + (screen.height-500)/2 + ',left=' + (screen.width-800)/2);
	self.location.reload();
	newPage.focus();
}

function openMalampayaMap() 
{ 
	url = "/images/company/projects/malampaya/map.gif";
	MalampayaMap = window.open(url,'MalampayaMap','resizable=0,toolbar=0,scrollbars=0,status=0,width=415,height=525,top=' + (screen.height-525)/2 + ',left=' + (screen.width-415)/2);
	self.location.reload();
	MalampayaMap.focus();
}

function setScrollColor(Color)
{
	switch (Color) {
	case 'green':
		document.body.style.scrollbarBaseColor = '#61AF99';
		document.body.style.scrollbarArrowColor = '#FFFFFF';
		document.body.style.scrollbarShadowColor = '#61AF99';
		document.body.style.scrollbarDarkShadowColor = '#2F5B4F';
		break;
	case 'blue':
		document.body.style.scrollbarBaseColor = '#2579C6';
		document.body.style.scrollbarArrowColor = '#FFFFFF';
		document.body.style.scrollbarShadowColor = '#2579C6';
		document.body.style.scrollbarDarkShadowColor = '#123A5F';
		break;}
}