
var appVer = navigator.appVersion.toLowerCase();
var userAgt = navigator.userAgent.toLowerCase();
var mac = (appVer.indexOf("mac") != -1);
var win = (appVer.indexOf("win") != -1);
var nn = (navigator.appName == "Netscape");
var ie = (navigator.appName == "Microsoft Internet Explorer");
var aol = (userAgt.indexOf("aol") != -1);
var opera = (userAgt.indexOf("opera") != -1);
var v4 = (parseInt(appVer) >= 4);
var ver = (ie) ? parseFloat(appVer.substring((appVer.indexOf('msie') + 5), appVer.length)) : parseFloat(appVer);
var remote;
var URL;

function toSmall(imagename){
	var temp=imagename.replace(/_lrg/g,"_sml");
	temp=temp.replace(/\/med\//g,"/sml/");
	temp=temp.replace(/\/lrg\//g,"/sml/");
	temp=temp.replace(/_med/g,"_sml");
return temp;
}

function toLarge(imagename){
	var temp=imagename.replace(/_sml/g,"_lrg");
	temp=temp.replace(/_med/g,"_lrg");
	temp=temp.replace(/\/med\//g,"/lrg/");
	temp=temp.replace(/\/sml\//g,"/lrg/");
return temp;
}

function brandimage(brandname){
	var temp=brandname;
	temp='/common/image/brought_icons/'+brandname+'.gif';
	return temp;
}

function brandimage(brandname){
	var temp=brandname;
	temp='/common/image/10_common/brought_icons/'+brandname+'.gif';
	return temp;
}

function toSmall(imagename){
	var temp=imagename.replace(/_lrg/g,"_sml");
	temp=temp.replace(/\/med\//g,"/sml/");
	temp=temp.replace(/\/lrg\//g,"/sml/");
	temp=temp.replace(/_med/g,"_sml");
return temp;
}

function toLarge(imagename){
	var temp=imagename.replace(/_sml/g,"_lrg");
	temp=temp.replace(/_med/g,"_lrg");
	temp=temp.replace(/\/med\//g,"/lrg/");
	temp=temp.replace(/\/sml\//g,"/lrg/");
return temp;
}

function brandimage(brandname){
	var temp=brandname;
	temp='/common/image/brought_icons/'+brandname+'.gif';
	return temp;
}

function formHandler(){
if (nn && v4) {
  var formref = document.prodinfo.document.pinfo;
}
else {
  var formref = document.pinfo;
}
var URL = formref.site.options[formref.site.selectedIndex].value;
window.location.href = URL;
}

function formHandler1(){
if (nn && v4) {
  var formref = document.prodinfo.document.pinfo;
}
else {
  var formref = document.pinfo;
}
var URL = formref.report.options[formref.report.selectedIndex].value;
window.location.href = URL;
}

function formHandler2(){
if (nn && v4) {
  var formref = document.prodinfo.document.pinfo;
}
else {
  var formref = document.pinfo;
}
var URL = formref.productinfo.options[formref.productinfo.selectedIndex].value;
window.location.href = URL;
}

function formHandler3(){
if (nn && v4) {
  var formref = document.prodinfo.document.pinfo;
}
else {
  var formref = document.pinfo;
}
var URL = formref.fav.options[formref.fav.selectedIndex].value;
window.location.href = URL;
}
function formHandler4(){
if (nn && v4) {
  var formref = document.prodinfo.document.pinfo;
}
else {
  var formref = document.pinfo;
}
var URL = formref.site_feed.options[formref.site_feed.selectedIndex].value;
window.location.href = URL;
}


function stockpop(URL) {
	remote = window.open(URL,"pop","scrollbars=0,toolbar=0,location=0,directories=0,status=0,menubar=0,width=325,height=275,screenX=200,screenY=240,left=200,top=220");
	remote.focus();
        if (remote.opener == null) remote.opener = self;
}

function checkBrowser(){
	
	 /*Commented by Corbus 01 Oct 2007 as Dibya request */ 
	/*
	this.ver=navigator.appVersion
   	this.dom=document.getElementById?1:0
	this.ie5=(this.ver.indexOf("MSIE 5")>-1 && this.dom)?1:0;
	this.ie4=(document.all && !this.dom)?1:0;
	this.ns5=(this.dom && parseInt(this.ver) >= 5) ?1:0;
	this.ns4=(document.layers && !this.dom)?1:0;
	this.bw=(this.ie5 || this.ie4 || this.ns4 || this.ns5)
	return this
	*/
	/*Added by Corbus 01 October 2007*/
	return true	

}
bw=new checkBrowser()

/*
* FUNCTION: blurLinks
* utitility function for turning off link focus (lines drawn around an active link) in browsers such as ie4Win
*/
function blurLinks() {
if(!document.links || document.links.length <= 0 || !getObj('document.links[0].focus')) return;
  for(var i = 0; i < document.links.length; i++) {
  document.links[i].onfocus = document.links[i].blur;
  }
}



/*
* FUNCTION: swapImg
* Image Swapping function.
*/
function swapImg() {
if(!document.images) return;
//alert('test');
var args = swapImg.arguments;
  for(var i = 0; i < args.length; i+=2) {
  var imgSrc = (args[i + 1].indexOf('[') != -1) ? eval(args[i + 1] + '.src') : args[i + 1];
  if(getImgObj(args[i])) getImgObj(args[i]).src = imgSrc;
  }
}

function getImgObj(name, doc) {
var i, layer, imgs;
  if(!doc) doc = document;

  // retrieve ie dom image or non-layer image
  if(doc.images[name]) return doc.images[name];

  // retrieve nn layer image
  for(var i = 0; i < doc.layers.length; i++) {
  layer = doc.layers[i];
  imgs = layer.document.images;
  if(imgs.length > 0 && imgs[name]) return imgs[name];
  if(layer.document.layers.length > 0) layer = getImgObj(name, layer.document);
  }
return 0;
}

function moveLayer(lyr,t,l) {
eval("csspObj('" + lyr + "').setProperty('top'," + t + ")");
eval("csspObj('" + lyr + "').setProperty('left'," + l + ")");
}

function move1(){
swapImg('flag1','/common/image/flags_0_1.gif');
moveLayer('move','144','7');
}

function move2(){
swapImg('flag2','/common/image/korea_b.gif');
moveLayer('move','165','7');
}

function move3(){
swapImg('flag3','/common/image/flags_2_1.gif');
moveLayer('move','185','7');
}

function move4(){
swapImg('flag4','/common/image/flags_3_1.gif');
moveLayer('move','205','7');
}

function move5(){
swapImg('flag5','/common/image/flags_4_1.gif');
moveLayer('move','226','7');
}

function move6(){
swapImg('flag6','/common/image/flags_5_1.gif');
moveLayer('move','246','7');
}

function move7(){
swapImg('flag7','/common/image/flags_6_1.gif');
moveLayer('move','268','7');
}

function move8(){
swapImg('flag8','/common/image/flags_7_1.gif');
moveLayer('move','289','7');
}

function move9(){
swapImg('flag9','/common/image/flags_8_1.gif');
moveLayer('move','310','7');
}

function move10(){
swapImg('flag10','/common/image/kazakhstan.gif');
moveLayer('move','332','7');
}

function move11(){
swapImg('flag11','/common/image/kyrgyzstan.gif');
moveLayer('move','353','7');
}

function move12(){
swapImg('flag12','/common/image/mongolia.gif');
moveLayer('move','374','7');
}

function move13(){
swapImg('flag13','/common/image/turkmenistan.gif');
moveLayer('move','395','7');
}

function move14(){
swapImg('flag14','/common/image/uzbekistan.gif');
moveLayer('move','416','7');
}

function move15(){
swapImg('flag15','/common/image/russia.gif');
moveLayer('move','438','7');
}

function move16(){
swapImg('flag16','/common/image/ukraine.gif');
moveLayer('move','458','7');
}

function move17(){
swapImg('flag17','/common/image/turkey_b.gif');
moveLayer('move','479','7');
}


/*
* FUNCTION: handleResize
* window reloading function
* refreshs window upon minimizing or maximizing browser window
*/
//if(window.captureEvents) {
//window.captureEvents(Event.RESIZE);
//window.onresize = handleResize;
//window.onresize = reloadPage;
//}
/*
function handleResize() {
location.reload();
return false;
}
*/

//function reloadPage(init) {
//  if (init==true) with (navigator) {
//    if (nn && v4) {
//    document.pgW=innerWidth;
//    document.pgH=innerHeight;
//    onresize=reloadPage;
//    }
//  }
//  else if (innerWidth!=document.pgW || innerHeight!=document.pgH)
//location.reload();
//}
//reloadPage(true);

var onloadHandlers = [];
function loadEvents() {
//if((ver<5) && win && ie) blurLinks();
  for(var i=0; i<onloadHandlers.length;i++) {
  eval(onloadHandlers[i]);
  }
}
window.onload = loadEvents;

var onresizeHandlers = [];
function resizeEvents() {
 for(var i=0; i<onresizeHandlers.length;i++) {
  eval(onresizeHandlers[i]);
  }
}
window.onresize = resizeEvents;

function handleResize(init) {
if(!(nn && v4)) return;
  if(init==true) with (navigator) {
  document.pgW=innerWidth;
  document.pgH=innerHeight;
  onresizeHandlers[onresizeHandlers.length] = 'handleResize()';
  }
  else if (innerWidth!=document.pgW || innerHeight!=document.pgH) location.reload();
}
handleResize(true);

var Params1;

if (document.images != null) {
Params1 = "width=450,height=300,";
}else{
Params1 = "width=425,height=300,";
}
Params1 += "resizable=0,status=0,menubar=0,scrollbars=1,location=1";

function Certify(URL) {
  popupWin = window.open(URL, 'Participant', Params1)
  window.top.name = 'opener';
  popupWin.focus();
}
function formHandler3(){
if (nn && v4) {
  var formref = document.prodinfo.document.pinfo;
}
else {
  var formref = document.pinfo;
}
var URL = formref.site_feed.options[formref.site_feed.selectedIndex].value;
window.location.href = URL;
}

function formHandler(oSelect){
	var pos;
 var http_pos;
	var URL = oSelect.options[oSelect.selectedIndex].value;

	pos = oSelect.options[oSelect.selectedIndex].value.indexOf('frameURL=');

	if (pos == -1) {  
  new_win_pos = oSelect.options[oSelect.selectedIndex].value.indexOf('new_win:');
  
  if (new_win_pos == 0) {
   var ref = getref(URL, (new_win_pos-1));
   window.open(ref);
  }
  
  else {
 		window.location.href = URL;  
  }
  
	}
	else {
		var ref = getref(URL, pos);
		URL = '/frameset_fs.jhtml?frameURL=' + escape(ref);
		window.location.href = URL;
	}
}

function getref(URL, pos) {
	var start = pos+9; //9 is the length of the string that determines pos
	var end = URL.length;
	var splitStr = URL.substring(start, end );
	return splitStr;
}



function toMed(imagename){
	var temp=imagename.replace(/_sqr/g,"_med");

return temp;
}

function toSmall(imagename){

	var temp=imagename.replace(/_lrg/g,"_sml");

	temp=temp.replace(/\/med\//g,"/sml/");

	temp=temp.replace(/\/lrg\//g,"/sml/");

	temp=temp.replace(/_med/g,"_sml");

return temp;

}



function toSmall(imagename){
	var temp=imagename.replace(/_lrg/g,"_sml");
	temp=temp.replace(/\/med\//g,"/sml/");
	temp=temp.replace(/\/lrg\//g,"/sml/");
	temp=temp.replace(/_med/g,"_sml");
return temp;
}

function toLarge(imagename){
	var temp=imagename.replace(/_sml/g,"_lrg");
	temp=temp.replace(/_med/g,"_lrg");
	temp=temp.replace(/\/med\//g,"/lrg/");
	temp=temp.replace(/\/sml\//g,"/lrg/");
return temp;
}

function resulst_pop(url) {
	quizWin=window.open(url, "", "toolbar=no,directories=no,status=no,location=0,resizable=no,scrollbars=no,menubar=no,width=300,height=300,screenY=25,screenX=25,top=25,left=25"); 
quizWin.focus();
}

function resulst_pop_fr(url) {
	quizWin=window.open(url, "", "toolbar=no,directories=no,status=no,location=0,resizable=no,scrollbars=no,menubar=no,width=300,height=400,screenY=25,screenX=25,top=25,left=25"); 
quizWin.focus();
}

var flashVersion = 0;
function getFlashVersion() {
	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') { 
			if (flashPlugin.description.indexOf('7.') != -1) flashVersion = 7;
			else if (flashPlugin.description.indexOf('6.') != -1) flashVersion = 6;
			else if (flashPlugin.description.indexOf('5.') != -1) flashVersion = 5;
			else if (flashPlugin.description.indexOf('4.') != -1) flashVersion = 4;
			else if (flashPlugin.description.indexOf('3.') != -1) flashVersion = 3;
		}
	}

	// 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) {

		//alert('test-1');

	   document.write('<scr' + 'ipt language="VBScript"\> \n');
		document.write('on error resume next \n');
		document.write('dim obFlash \n');
		document.write('set obFlash = CreateObject("ShockwaveFlash.ShockwaveFlash.7") \n');
		document.write('if IsObject(obFlash) then \n');
		document.write('flashVersion = 7 \n');
		document.write('else set obFlash = CreateObject("ShockwaveFlash.ShockwaveFlash.6") end if \n');
		document.write('if flashVersion < 7 and IsObject(obFlash) then \n');
		document.write('flashVersion = 6 \n');
		document.write('else set obFlash = CreateObject("ShockwaveFlash.ShockwaveFlash.5") end if \n');
		document.write('if flashVersion < 6 and IsObject(obFlash) then \n');
		document.write('flashVersion = 5 \n');
		document.write('else set obFlash = CreateObject("ShockwaveFlash.ShockwaveFlash.4") end if \n');
		document.write('if flashVersion < 5 and IsObject(obFlash) then \n');
		document.write('flashVersion = 4 \n');
		document.write('else set obFlash = CreateObject("ShockwaveFlash.ShockwaveFlash.3") end if \n');
		document.write('if flashVersion < 4 and IsObject(obFlash) then \n');
		document.write('flashVersion = 3 \n');
		document.write('end if');
		document.write('</scr' + 'ipt\> \n');
  }
		
	// 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;

function interrupt_pop(URL) {
 window.open(URL,"int","scrollbars=0,toolbar=0,location=0,directories=0,status=0,menubar=0,width=400,height=200,screenX=200,screenY=240,left=200,top=220");
}


/**
 * FlashObject v1.2.2: Flash detection and embed - http://blog.deconcept.com/flashobject/
 *
 * FlashObject is (c) 2005 Geoff Stearns and is released under the MIT License:
 * http://www.opensource.org/licenses/mit-license.php
 *
 */
if(typeof com == "undefined") var com = new Object();
if(typeof com.deconcept == "undefined") com.deconcept = new Object();
if(typeof com.deconcept.util == "undefined") com.deconcept.util = new Object();
if(typeof com.deconcept.FlashObjectUtil == "undefined") com.deconcept.FlashObjectUtil = new Object();
com.deconcept.FlashObject = function(swf, id, w, h, ver, c, quality, redirectUrl, detectKey){
	this.DETECT_KEY = detectKey ? detectKey : 'detectflash';
	this.skipDetect = com.deconcept.util.getRequestParameter(this.DETECT_KEY);
	this.params = new Object();
	this.variables = new Object();
	this.attributes = new Array();

	if(swf) this.setAttribute('swf', swf);
	if(id) this.setAttribute('id', id);
	if(w) this.setAttribute('width', w);
	if(h) this.setAttribute('height', h);
	if(ver) this.setAttribute('version', new com.deconcept.PlayerVersion(ver.toString().split(".")));
	if(c) this.addParam('bgcolor', c);
	var q = quality ? quality : 'high';
	this.addParam('quality', q);
	this.setAttribute('redirectUrl', '');
	//alert('test-2');
	if(redirectUrl) this.setAttribute('redirectUrl', redirectUrl);
}
com.deconcept.FlashObject.prototype.setAttribute = function(name, value){
	this.attributes[name] = value;
}
com.deconcept.FlashObject.prototype.getAttribute = function(name){
	return this.attributes[name];
}
com.deconcept.FlashObject.prototype.getAttributes = function(){
	return this.attributes;
}
com.deconcept.FlashObject.prototype.addParam = function(name, value){
	this.params[name] = value;
}
com.deconcept.FlashObject.prototype.getParams = function(){
	return this.params;
}
com.deconcept.FlashObject.prototype.getParam = function(name){
	return this.params[name];
}
com.deconcept.FlashObject.prototype.addVariable = function(name, value){
	this.variables[name] = value;
}
com.deconcept.FlashObject.prototype.getVariable = function(name){
	return this.variables[name];
}
com.deconcept.FlashObject.prototype.getVariables = function(){
	return this.variables;
}
com.deconcept.FlashObject.prototype.getParamTags = function(){
	//alert('test-3');
   var paramTags = ""; var key; var params = this.getParams();
   for(key in params) {
        paramTags += '<param name="' + key + '" value="' + params[key] + '" />';
    }
   return paramTags;
}
com.deconcept.FlashObject.prototype.getVariablePairs = function(){
	var variablePairs = new Array();
	var key;
	var variables = this.getVariables();
	for(key in variables){
		variablePairs.push(key +"="+ variables[key]);
	}
	return variablePairs;
}
com.deconcept.FlashObject.prototype.getHTML = function() {
    var flashHTML = "";
    if (navigator.plugins && navigator.mimeTypes && navigator.mimeTypes.length) { // netscape plugin architecture
	//alert('test-4');
        flashHTML += '<embed type="application/x-shockwave-flash" src="'+ this.getAttribute('swf') +'" width="'+ this.getAttribute('width') +'" height="'+ this.getAttribute('height') +'" id="'+ this.getAttribute('id') + '" name="'+ this.getAttribute('id') +'"';
		var params = this.getParams();
        for(var key in params){ flashHTML += ' '+ key +'="'+ params[key] +'"'; }
		pairs = this.getVariablePairs().join("&");
        if (pairs.length > 0){ flashHTML += ' flashvars="'+ pairs +'"'; }
        flashHTML += '></embed>';
    } else { // PC IE
	//alert('test-5');
        flashHTML += '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="'+ this.getAttribute('width') +'" height="'+ this.getAttribute('height') +'" id="'+ this.getAttribute('id') +'">';
        flashHTML += '<param name="movie" value="' + this.getAttribute('swf') + '" />';
		var tags = this.getParamTags();
        if(tags.length > 0){ flashHTML += tags; }
		var pairs = this.getVariablePairs().join("&");
        if(pairs.length > 0){ flashHTML += '<param name="flashvars" value="'+ pairs +'" />'; }
        flashHTML += '</object>';
    }
    return flashHTML;
}
com.deconcept.FlashObject.prototype.write = function(elementId){
	if(this.skipDetect || com.deconcept.FlashObjectUtil.getPlayerVersion().versionIsValid(this.getAttribute('version'))){
		if(document.getElementById){
			document.getElementById(elementId).innerHTML = this.getHTML();
		}
	}else{
		if(this.getAttribute('redirectUrl') != "") {
			document.location.replace(this.getAttribute('redirectUrl'));
		}
	}
}
/* ---- detection functions ---- */
com.deconcept.FlashObjectUtil.getPlayerVersion = function(){
   var PlayerVersion = new com.deconcept.PlayerVersion(0,0,0);
	if(navigator.plugins && navigator.mimeTypes.length){
		//alert('test-6');
		var x = navigator.plugins["Shockwave Flash"];
		if(x && x.description) {
			PlayerVersion = new com.deconcept.PlayerVersion(x.description.replace(/([a-z]|[A-Z]|\s)+/, "").replace(/(\s+r|\s+b[0-9]+)/, ".").split("."));
		}
	}else if (window.ActiveXObject){
	   try {
		   //alert('test-7');
   	   var axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
   		PlayerVersion = new com.deconcept.PlayerVersion(axo.GetVariable("$version").split(" ")[1].split(","));
	   } catch (e) {}
	}
	return PlayerVersion;
}
com.deconcept.PlayerVersion = function(arrVersion){
	this.major = parseInt(arrVersion[0]) || 0;
	this.minor = parseInt(arrVersion[1]) || 0;
	this.rev = parseInt(arrVersion[2]) || 0;
}
com.deconcept.PlayerVersion.prototype.versionIsValid = function(fv){
	if(this.major < fv.major) return false;
	if(this.major > fv.major) return true;
	if(this.minor < fv.minor) return false;
	if(this.minor > fv.minor) return true;
	if(this.rev < fv.rev) return false;
	return true;
}
/* ---- get value of query string param ---- */
com.deconcept.util.getRequestParameter = function(param){
	var q = document.location.search || document.location.href.hash;
	if(q){
		var startIndex = q.indexOf(param +"=");
		var endIndex = (q.indexOf("&", startIndex) > -1) ? q.indexOf("&", startIndex) : q.length;
		if (q.length > 1 && startIndex > -1) {
			return q.substring(q.indexOf("=", startIndex)+1, endIndex);
		}
	}
	return "";
}

/* add Array.push if needed (ie5) */
if (Array.prototype.push == null) { Array.prototype.push = function(item) { this[this.length] = item; return this.length; }}

/* add some aliases for ease of use / backwards compatibility */
var getQueryParamValue = com.deconcept.util.getRequestParameter;
var FlashObject = com.deconcept.FlashObject;

function openNewsletter(url) {
 quizWin=window.open(url, "", "toolbar=no,directories=no,status=no,location=0,resizable=no,scrollbars=yes,menubar=no,width=732,screenY=25,screenX=25,top=25,left=25")
	}
 
 function openFlashTab() {
 window.open("http://www.pgconnectdevelop.com");
 }