// Flash Version Detector  v1.2.1
// documentation: http://www.dithered.com/javascript/flash_detect/index.html
// license: http://creativecommons.org/licenses/by/1.0/
// code by Chris Nott (chris[at]dithered[dot]com)
// with VBScript code from Alastair Hamilton (now somewhat modified)



function isDefined(property) {
  return (typeof property != 'undefined');
}

var flashVersion = 0;
function getFlashVersion() {
var latestFlashVersion = 8;
   var agent = navigator.userAgent.toLowerCase(); 
	
   // NS3 needs flashVersion to be a local variable
   if (agent.indexOf("mozilla/3") != -1 && agent.indexOf("msie") == -1) {
      flashVersion = 0;
   }
   
	// NS3+, Opera3+, IE5+ Mac (support plugin array):  check for Flash plugin in plugin array
	if (navigator.plugins != null && navigator.plugins.length > 0) {
		var flashPlugin = navigator.plugins['Shockwave Flash'];
		if (typeof flashPlugin == 'object') { 
			for (var i = latestFlashVersion; i >= 3; i--) {
            if (flashPlugin.description.indexOf(i + '.') != -1) {
               flashVersion = i;
               break;
            }
         }
		}
	}

	// IE4+ Win32:  attempt to create an ActiveX object using VBScript
	else if (agent.indexOf("msie") != -1 && parseInt(navigator.appVersion) >= 4 && agent.indexOf("win")!=-1 && agent.indexOf("16bit")==-1) {
	   var doc = '<scr' + 'ipt language="VBScript"\> \n';
      doc += 'On Error Resume Next \n';
      doc += 'Dim obFlash \n';
      doc += 'For i = ' + latestFlashVersion + ' To 3 Step -1 \n';
      doc += '   Set obFlash = CreateObject("ShockwaveFlash.ShockwaveFlash." & i) \n';
      doc += '   If IsObject(obFlash) Then \n';
      doc += '      flashVersion = i \n';
      doc += '      Exit For \n';
      doc += '   End If \n';
      doc += 'Next \n';
      doc += '</scr' + 'ipt\> \n';
      document.write(doc);
   }
		
	// WebTV 2.5 supports flash 3
	else if (agent.indexOf("webtv/2.5") != -1) flashVersion = 3;

	// older WebTV supports flash 2
	else if (agent.indexOf("webtv") != -1) flashVersion = 2;

	// Can't detect in all other cases
	else {
		flashVersion = flashVersion_DONTKNOW;
	}

	return flashVersion;
}

flashVersion_DONTKNOW = -1;


var agt= navigator.userAgent.toLowerCase();

var noflashText=new Array() //Heading and text for non flash banners
noflashText[0]="<br /><br /><br /><br /><h1>GlaxoSmithKline Latvija</h1>"
noflashText[1]="<br /><br /><br /><br /><h1>GlaxoSmithKline Latvija</h1>"
noflashText[2]="<br /><br /><br /><br /><h1>GlaxoSmithKline Latvija</h1>"

function FlashTag(p_Section, p_flash, p_height, p_txtsize, p_txtalt,p_link,p_Newimg){
	if (!p_flash || getFlashVersion() < 7){
	
			if (p_Newimg !=""){
				if (p_height =="220"){
					document.write('<div id="txt-top-noflash" style="	background-image:url();	background-position:left top;background-repeat:no-repeat;">'+ noflashText[flashBg-1] +'</div>');
				}
			}
	}
	else {
		if(agt.indexOf("safari")!=-1)  {
		 
			if (p_height =="220"){
					document.write('<div id="txt-top-noflash" style="	background-image:url(common/common/img/banner/0' + flashBg + '_01.jpg);	background-position:left top;background-repeat:no-repeat;">'+ noflashText[flashBg-1] +'</div>');
			}
		}
		else {
			var el=document.getElementById('header'); 
			el.className ="flashBack"+flashBg;
			document.write('<object type="application/x-shockwave-flash" data="common/homePage.swf?Id='+ (flashBg - 1) +'" width="760" height="220">');
			document.write('<param name="movie" value="common/homePage.swf?Id='+ (flashBg - 1) +'" />');
			document.write('<param name="allowScriptAccess" value="sameDomain" />');
			document.write('<param name="wmode" value="transparent" />');
			document.write('<embed src="common/homePage.swf?Id='+ (flashBg - 1) +'" quality="high" wmode="transparent" bgcolor="#ffffff" width="760" height="220" name="homePage" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />');
			document.write(' </object>');			
		   }
			
	   } 
	 
}


	
/*  TABLE     display: block;*/

var height;
var Category;
function displaySwapShow(p_id, p_class){
	if(document.getElementById(p_id)!='undefined'&&document.getElementById(p_id)!=null){
		document.getElementById(p_id).style.display = 'block'
	
		
		if (height =="280"){
		document.getElementById(p_class).className ="hmenu-table-off";
		}
		else{
			document.getElementById(p_class).className ="menu-table-off";
	
		
		}

		if (Category =="utilities") {
		 document.getElementById(p_class).className ="menu-contact-table-off";
		}
		

	}
}	

function displaySwapHidden(p_id, p_class)
{
	if(document.getElementById(p_id)!='undefined'&&document.getElementById(p_id)!=null)
	{
		document.getElementById(p_id).style.display = 'none' 
		if (height =="280"){
		document.getElementById(p_class).className ="hmenu-table";
		}
		else{
		document.getElementById(p_class).className ="menu-table";
		}
		if (Category =="utilities") {
		 document.getElementById(p_class).className ="menu-contact-table";
		}	
		
	}
}

function displayShow(p_id) {

		 document.getElementById(p_id).style.display = 'block';
}
function displayHidden(p_id) {

			document.getElementById(p_id).style.display = 'none';
}


				
function swapIt(hide,show) {
    show.style.display = "";
    hide.style.display = "none";
  }


/* END TABLE     display: block;*/	

/*

				Drop down

*/

function dropdown(mySel){
var myWin, myVal;
myVal = mySel.options[mySel.selectedIndex].value;
	if(myVal){
			if(mySel.form.target)myWin = parent[mySel.form.target];
			
			else myWin = window;
			
			if (! myWin) return true;
			myWin.location = myVal;
	   }
return false;
}
function dropdownTarget(mySel){
var myWin, myVal;
if(mySel.selectedIndex!=0)
{
myVal = mySel.options[mySel.selectedIndex].value;
	if(myVal){
			if(mySel.form.target)myWin = parent[mySel.form.target];
			
			else myWin = window;
			if (! myWin) return true;
		 	if (myVal.charAt(0)=="/")
				{
					 myWin.location = myVal;
				}
				else
				{

					myWin.open(myVal);
				}
			
			
	   }
}
return false;
}



/*

				OPEN WINDOW

*/

function DW1(dwURL) {
popupWin = window.open(dwURL, 'DW1', 'scrollbars,resizable=yes,width=700,height=600,left=25,top=25');
window.top.name = 'opener';
}
function DW(dwURL) {
popupWin = window.open(dwURL, 'DW', 'scrollbars,resizable=yes,width=517,height=400,left=25,top=25');
window.top.name = 'opener';
}
function DW2(dwURL) {
popupWin = window.open(dwURL, 'DW', 'scrollbars,resizable=yes,width=433,height=400,left=25,top=25');
window.top.name = 'opener';
}
function DW4(dwURL) {
popupWin = window.open(dwURL, 'DW', 'scrollbars,resizable=yes,width=560,height=370,left=25,top=25');
window.top.name = 'opener';
}
function DW5(dwURL) {
popupWin = window.open(dwURL, 'DW', 'scrollbars,resizable=yes,width=587,height=370,left=25,top=25');
window.top.name = 'opener';
}
function DW6(dwURL) {
popupWin = window.open(dwURL, 'DW', 'scrollbars,resizable=yes,width=587,height=570,left=25,top=25');
window.top.name = 'opener';
}
function DW8(dwURL) {
popupWin = window.open(dwURL, 'DW8', 'resizable=no,width=400,height=590,left=25,top=25');
window.top.name = 'opener';
}


function Present(dwURL) {
popupWin = window.open(dwURL, 'DW', 'scrollbars,resizable=yes,width=805,height=450,left=25,top=25');
window.top.name = 'opener';
}
function Present2(dwURL) {
popupWin = window.open(dwURL, 'DW', 'scrollbars,resizable=yes,width=790,height=593,left=25,top=25');
window.top.name = 'opener';
}
function External(dwURL) {
popupWin = window.open(dwURL, 'DW1', 'toolbar=yes,location=yes,status=yes,menubar=yes,scrollbars=yes,resizable=yes,width=700,height=600,left=25,top=25');
window.top.name = 'opener';
}



//legacy script - used everywhere except careers
function DW1(dwURL) {
popupWin = window.open(dwURL, 'DW1', 'scrollbars,resizable=yes,width=700,height=600,left=25,top=25');
window.top.name = 'opener';
}
//used in careers - updated as it clashed with earlier version of DW1 used in the about section
function DWjoin(dwURL) {
popupWin = window.open(dwURL, 'DWjoin', 'scrollbars,resizable=yes,width=600,height=550,left=25,top=25');
window.top.name = 'opener';
}

function DWUS(dwURL) {
popupWin = window.open(dwURL, 'DWUS', 'scrollbars,resizable=yes,width=575,height=500,left=25,top=25');
window.top.name = 'opener';
}


function MM_jumpMenu(targ,selObj,restore){ //v3.0
var loc = "http://"+selObj.options[selObj.selectedIndex].value;
if(loc.length > 9)
	window.location=loc;
}

function Profile(dwURL) {
popupWin = window.open(dwURL, 'DW', 'scrollbars,resizable=yes,width=667,height=450,left=25,top=25');
window.top.name = 'opener';
}

function Hemscott(dwURL) {
popupWin = window.open(dwURL, 'DW', 'scrollbars,resizable=yes,width=667,height=450,left=25,top=25');
window.top.name = 'opener';
}
//used in the products section mainly
function openProducts(dwURL) {
  products = window.open(dwURL, 'products', 'scrollbars,resizable=yes,width=520,height=400,left=25,top=25');
  window.top.name = 'opener';
}

function Profilebig(dwURL) {
popupWin = window.open(dwURL, 'DW', 'scrollbars,resizable=yes,width=800,height=700,left=25,top=25');
window.top.name = 'opener';
}

function PCbig(dwURL) {
popupWin = window.open(dwURL, 'DW', 'scrollbars,resizable=yes,width=882,height=600,left=25,top=25');
window.top.name = 'opener';
}

function chartinfo(dwURL) {
popupWin = window.open(dwURL, 'DW', 'scrollbars,resizable=yes,width=300,height=200');
window.top.name = 'opener';
}
//Used for flash content in Your Health
function healthflash(dwURL) {
popupWin = window.open(dwURL, 'DW', 'resizable=yes,width=585,height=445,left=25,top=25');
window.top.name = 'opener';
}

function doSearch() {
  document.forms[1].submit();
}
function display_search() {
  if (navigator.appName == "Netscape") { 
    document.write("<input type=text name=Search size=8 maxlength=50>");
  }
  else { 
    document.write("<input type=text name=Search size=14 maxlength=50>");
  }
}

//About us/background/history flash file/ Function written for calling from the flash movie. It turns all divs off besides the one requested.
function displayHideOthers(p_id) {

		 document.getElementById('1700').style.display = 'none';
		 document.getElementById('1800').style.display = 'none';
		 document.getElementById('1850').style.display = 'none';
 		 document.getElementById('1900').style.display = 'none';				 		 
 		 document.getElementById('1950').style.display = 'none';
		 document.getElementById('2000').style.display = 'none';		 
		 document.getElementById(p_id).style.display = 'block';
}


//Community/default page/Function written for calling from the flash movie. It turns all divs off besides the one requested.
function displayPartnership(p_id) {

		 document.getElementById('prog0').style.display = 'none';
		 document.getElementById('prog1').style.display = 'none';
		 document.getElementById('prog2').style.display = 'none';
		 document.getElementById('prog3').style.display = 'none';
 		 document.getElementById('prog4').style.display = 'none';				 		 
 		 document.getElementById('prog5').style.display = 'none';
		 document.getElementById('prog6').style.display = 'none';
		 document.getElementById('prog7').style.display = 'none';
		 document.getElementById('prog8').style.display = 'none';
		 document.getElementById('prog9').style.display = 'none';
 		 document.getElementById('prog10').style.display = 'none';				 		 
 		 document.getElementById('prog11').style.display = 'none';
		 document.getElementById('prog12').style.display = 'none';	
		 document.getElementById(p_id).style.display = 'block';		 

}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

/*Code added by Wipro-Munish*/
onload=function () {
	var pageURL = document.location.href;
	var pageName = pageURL.slice(pageURL.lastIndexOf('/')+1, pageURL.lastIndexOf('.'));
	if (pageName=='index' || pageName=='') {
		var docElement = document.getElementById('index');
	}
	else {
		
		var pagenameSub = pageName.slice(0,pageName.lastIndexOf('-'));
		var docElement = document.getElementById(pagenameSub);
	}
	if (docElement != null) {
		docElement.style.backgroundImage = "url(images/activeLink-arrow.gif)";
		docElement.style.backgroundRepeat = "no-repeat";
		docElement.style.backgroundPosition = "left center";
		docElement.style.color = "#f55a1c";
	}
}