// ** COMMON **

// Suppress error message

function StopError() {
         return true;
}

//window.onerror = StopError;

// Flash detection init

var fd_requiredVersion = 6;

var fd_flash2Installed = false;
var fd_flash3Installed = false;
var fd_flash4Installed = false;
var fd_flash5Installed = false;
var fd_flash6Installed = false;
var fd_flash7Installed = false;
var fd_flash8Installed = false;
var fd_flash9Installed = false;
var fd_maxVersion = 9;
var fd_actualVersion = 0;

if (document.all && !window.opera) var browser_IE = true; else var browser_IE = false;
if (navigator.appVersion.indexOf("Windows") != -1) var browser_Win = true; else var browser_Win = false;

if (browser_IE && browser_Win) {
	document.write ('<SCR' + 'IPT LANGUAGE=VBScript\> \n');
	document.write ('on error resume next \n');
	document.write ('fd_flash2Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.2"))) \n');
	document.write ('fd_flash3Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.3"))) \n');
	document.write ('fd_flash4Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.4"))) \n');
	document.write ('fd_flash5Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.5"))) \n');  
	document.write ('fd_flash6Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.6"))) \n');  
	document.write ('fd_flash7Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.7"))) \n');  
	document.write ('fd_flash8Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.8"))) \n');  
	document.write ('fd_flash9Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.9"))) \n');  
	document.write ('</SCR' + 'IPT\> \n');
}


// ** FUNCTIONS **

function OpenPopUp(width,height,name,scroll) {

// FUNCTION: OpenPopUp
// DESCRIPTION: opens up a new popup window with minimal browser UI-elements (ie. no menubars etc),
// optionally with scrollbars (depending in scroll-arguments). The new window is opened up with a blank page,
// the actual file for the window comes from the HREF-parameter of the link that is used to open up the popup
// as far as the TARGET-parameter of the link is the same as the name of the popup.
// ARGUMENTS:
//   width: (positive integers) the width of the popup window. defaults to 600.
//   height: (positive integers) the height of the popup window. defaults to 400.
//   name: (string) name of the popup window. this is used as TARGET in the link that is used to open up the popup. //         defaults to nokiafiPopUp
//   scroll: (string) use scrollbars in window if value is set to "scroll", "yes" or 1.
//           otherwise no scrollbars are visible
// USAGE:
//   example: <a href="popup.html" target="popupname" onClick="OpenPopUp(750,600,'popupname','no');">open pop up</a>

	var scrollbars;
	if ( (width == null) || (width <= 0) ) {
		width = 600;
	}
	if ( (height == null) || (height <= 0) ) {
		height = 400;
	}
	if (name == null) {
		name = "nokiafiPopUp";
	}
	if ( (scroll == "scroll") || (scroll == "yes") || (scroll == 1)) {
		scrollbars = "yes";
	} else {
		scrollbars = "no";
	}

	nokiafiPopUpWin=window.open("",name,"directories=no,width="+width+",height="+height+"location=no,menubar=no,personalbar=no,resizable=no,scrollbars="+scrollbars+",status=no,toolbar=no");
	nokiafiPopUpWin.focus();

} // function OpenPopUp


function OpenWindow(width,height,name,parameters) {

// FUNCTION: OpenWindow
// DESCRIPTION: opens up a new popup window. The amount of browser UI-elements are configurable as arguments in the function call.
// The new window is opened up with a blank page, the actual file for the window comes from the HREF-parameter of
// the link that is used to open up the popup as far as the TARGET-parameter of the link is the same as the name of the popup.
// ARGUMENTS:
//   width: (positive integers) the width of the popup window. defaults to 600.
//   height: (positive integers) the height of the popup window. defaults to 400.
//   name: (string) name of the popup window. this is used as TARGET in the link that is used to open up the popup. defaults to nokiafiPopUp
//   parameters: (string) the parameters string for the window.open-function. if no parameters are given, a default parameter string is used instead (giving the new window minimal browser UI-elements)
// USAGE:
//   example: <a href="popup.html" target="popupname" onClick="OpenWindow(750,600,'popupname','');">open pop up</a>
//   example: <a href="popup.html" target="popupname" onClick="OpenWindow(750,600,'','resizable=yes,scrollbars=yes');">open pop up</a>

	var parameterString;
	if ( (width == "") || (width <= 0) ) {
		width = 600;
	}
	if ( (height == "") || (height <= 0) ) {
		height = 400;
	}
	if (name == "") {
		name = "nokiafiPopUp";
	}
	if (parameters) {
		parameterString = "width="+width+",height="+height+",personalbar=no,directories=no,"+parameters;
	} else {
		parameterString = "width="+width+",height="+height+",personalbar=no,directories=no,location=no,menubar=no,resizable=no,scrollbars=no,status=no,toolbar=no";
	}
	nokiafiPopUpWin=window.open("",name,parameterString);
	nokiafiPopUpWin.focus();

} // function OpenWindow


function DetectFlash(localRequiredVersion) {

// FUNCTION: DetectFlash
// DESCRIPTION: Detects the existence of a spesific version of the Flash plugin. Return value can be used to include eather the code for flash elements or the code for alternative non-Flash elements.
// ARGUMENTS:
//   localRequiredVersion: (positive integers, optional) required version of the Flash plugin. If the argument is not given, global variable fd_requiredVersion is used as required version.
// RETURNS:
//   (boolean) True if correct version of the Flash plugin was detected, otherwise false.


	var hasRightVersion = false;

	if (navigator.plugins) {
		if (navigator.plugins["Shockwave Flash 2.0"] || navigator.plugins["Shockwave Flash"]) {
			var isVersion2 = navigator.plugins["Shockwave Flash 2.0"] ? " 2.0" : "";
			var flashDescription = navigator.plugins["Shockwave Flash" + isVersion2].description;
			var flashVersion = parseInt(flashDescription.charAt(flashDescription.indexOf(".") - 1));
			fd_flash2Installed = flashVersion == 2;
			fd_flash3Installed = flashVersion == 3;
			fd_flash4Installed = flashVersion == 4;
			fd_flash5Installed = flashVersion == 5;
			fd_flash6Installed = flashVersion == 6;
			fd_flash7Installed = flashVersion == 7;
			fd_flash8Installed = flashVersion == 8;
			fd_flash9Installed = flashVersion >= 9;
		}
	}

	for (var i = 2; i <= fd_maxVersion; i++) {
		if (eval("fd_flash" + i + "Installed == true")) fd_actualVersion = i;
	}

	if (localRequiredVersion) {
		if (fd_actualVersion >= localRequiredVersion) { hasRightVersion = true; }
	}
	else {
		if (fd_actualVersion >= fd_requiredVersion) { hasRightVersion = true; }
	}

	return hasRightVersion;

}  // function DetectFlash


function NavigateFromDropDown(selectedMenu) {
	var url = selectedMenu.options[selectedMenu.selectedIndex].value;
	if ( (url != "#") && (url != "") ) {
		window.location.href = url;
	}
}  // function NavigateFromDropDown


function Show3DJava (elementId,archive,code,width,height,paramSrc,paramMovie,paramFlashVars) {
// FUNCTION: Show3DJava
// DESCRIPTION: Shows Java-applet on the product page for displaying the 3D-model of the phone.
// ARGUMENTS:
//   elementId: (string) ID of the HTML element to replace with the Java-applet
//   archive: (string) archive-parameter for the applet
//   code: (string) code-parameter for the applet
//   width: (positive integer) width of the applet
//   height: (positive integer) height of the applet
//   paramSrc: (string, optional) value for parameter named "src" for the applet
//   paramMovie: (string, optional) value for parameter named "movie" for the applet
//   paramFlashVars: (string, optional) value for parameter named "flashVars" for the applet

	var appletHTML;
    appletHTML = '<!--[if !IE]>-->';
    appletHTML += '<object classid="java:'+code+'.class" ';
    appletHTML += 'type="application/x-java-applet"';
    appletHTML += 'archive="'+archive+'" ';
    appletHTML += 'width="'+width+'" height="'+height+'" >';
	if (paramSrc) {
	    appletHTML += '<param name="src" value="'+paramSrc+'" />';
	}
	if (paramMovie) {
	    appletHTML += '<param name="movie" value="'+paramMovie+'" />';
	}
	if (paramFlashVars) {
	    appletHTML += '<param name="flashVars" value="'+paramFlashVars+'" />';
	}
    appletHTML += '<param name="scale" value="showall" />';
    appletHTML += '<!--<![endif]-->';
    appletHTML += '<object classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93" ';
    appletHTML += 'width="'+width+'" height="'+height+'" > ';
    appletHTML += '<param name="code" value="'+code+'" />';
    appletHTML += '<param name="archive" value="'+archive+'" />';
	if (paramSrc) {
	    appletHTML += '<param name="src" value="'+paramSrc+'" />';
	}
	if (paramMovie) {
	    appletHTML += '<param name="movie" value="'+paramMovie+'" />';
	}
	if (paramFlashVars) {
	    appletHTML += '<param name="flashVars" value="'+paramFlashVars+'" />';
	}
    appletHTML += '<param name="scale" value="showall" />';
    appletHTML += '</object> ';
    appletHTML += '<!--[if !IE]>-->';
    appletHTML += '</object>';
    appletHTML += '<!--<![endif]-->';
	
	var n = (typeof elementId == 'string') ? document.getElementById(elementId) : elementId;
	n.innerHTML = appletHTML;
	
} // function Show3DJava


// ** FLASHOBJECT **

/**
 * FlashObject v1.3c: Flash detection and embed - http://blog.deconcept.com/flashobject/
 *
 * FlashObject is (c) 2006 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, useExpressInstall, quality, xiRedirectUrl, redirectUrl, detectKey){
  if (!document.createElement || !document.getElementById) return;
  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();
  this.useExpressInstall = useExpressInstall;

  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(".")));
  this.installedVer = com.deconcept.FlashObjectUtil.getPlayerVersion(this.getAttribute('version'), useExpressInstall);
  if(c) this.addParam('bgcolor', c);
  var q = quality ? quality : 'high';
  this.addParam('quality', q);
  var xir = (xiRedirectUrl) ? xiRedirectUrl : window.location;
  this.setAttribute('xiRedirectUrl', xir);
  this.setAttribute('redirectUrl', '');
  if(redirectUrl) this.setAttribute('redirectUrl', redirectUrl);
}
com.deconcept.FlashObject.prototype = {
  setAttribute: function(name, value){
    this.attributes[name] = value;
  },
  getAttribute: function(name){
    return this.attributes[name];
  },
  addParam: function(name, value){
    this.params[name] = value;
  },
  getParams: function(){
    return this.params;
  },
  addVariable: function(name, value){
    this.variables[name] = value;
  },
  getVariable: function(name){
    return this.variables[name];
  },
  getVariables: function(){
    return this.variables;
  },
  createParamTag: function(n, v){
    var p = document.createElement('param');
    p.setAttribute('name', n);
    p.setAttribute('value', v);
    return p;
  },
  getVariablePairs: function(){
    var variablePairs = new Array();
    var key;
    var variables = this.getVariables();
    for(key in variables){
      variablePairs.push(key +"="+ variables[key]);
    }
    return variablePairs;
  },
  getFlashHTML: function() {
    var flashNode = "";
    if (navigator.plugins && navigator.mimeTypes && navigator.mimeTypes.length) { // netscape plugin architecture
      if (this.getAttribute("doExpressInstall")) this.addVariable("MMplayerType", "PlugIn");
      flashNode = '<embed type="application/x-shockwave-flash" src="'+ this.getAttribute('swf') +'" width="'+ this.getAttribute('width') +'" height="'+ this.getAttribute('height') +'"';
      flashNode += ' id="'+ this.getAttribute('id') +'" name="'+ this.getAttribute('id') +'" ';
      var params = this.getParams();
       for(var key in params){ flashNode += [key] +'="'+ params[key] +'" '; }
      var pairs = this.getVariablePairs().join("&");
       if (pairs.length > 0){ flashNode += 'flashvars="'+ pairs +'"'; }
      flashNode += '/>';
    } else { // PC IE
      if (this.getAttribute("doExpressInstall")) this.addVariable("MMplayerType", "ActiveX");
      flashNode = '<object id="'+ this.getAttribute('id') +'" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="'+ this.getAttribute('width') +'" height="'+ this.getAttribute('height') +'">';
      flashNode += '<param name="movie" value="'+ this.getAttribute('swf') +'" />';
      var params = this.getParams();
      for(var key in params) {
       flashNode += '<param name="'+ key +'" value="'+ params[key] +'" />';
      }
      var pairs = this.getVariablePairs().join("&");
      if(pairs.length > 0) {flashNode += '<param name="flashvars" value="'+ pairs +'" />';}
      flashNode += "</object>";
    }
    return flashNode;
  },
  write: function(elementId){
    if(this.useExpressInstall) {
      // check to see if we need to do an express install
      var expressInstallReqVer = new com.deconcept.PlayerVersion([6,0,65]);
      if (this.installedVer.versionIsValid(expressInstallReqVer) && !this.installedVer.versionIsValid(this.getAttribute('version'))) {
        this.setAttribute('doExpressInstall', true);
        this.addVariable("MMredirectURL", escape(this.getAttribute('xiRedirectUrl')));
        document.title = document.title.slice(0, 47) + " - Flash Player Installation";
        this.addVariable("MMdoctitle", document.title);
      }
    } else {
      this.setAttribute('doExpressInstall', false);
    }
    if(this.skipDetect || this.getAttribute('doExpressInstall') || this.installedVer.versionIsValid(this.getAttribute('version'))){
      var n = (typeof elementId == 'string') ? document.getElementById(elementId) : elementId;
      n.innerHTML = this.getFlashHTML();
    }else{
      if(this.getAttribute('redirectUrl') != "") {
        document.location.replace(this.getAttribute('redirectUrl'));
      }
    }
  }
}

/* ---- detection functions ---- */
com.deconcept.FlashObjectUtil.getPlayerVersion = function(reqVer, xiInstall){
  var PlayerVersion = new com.deconcept.PlayerVersion(0,0,0);
  if(navigator.plugins && navigator.mimeTypes.length){
    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{
    try{
      var axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
      for (var i=3; axo!=null; i++) {
        axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash."+i);
        PlayerVersion = new com.deconcept.PlayerVersion([i,0,0]);
      }
    }catch(e){}
    if (reqVer && PlayerVersion.major > reqVer.major) return PlayerVersion; // version is ok, skip minor detection
    // this only does the minor rev lookup if the user's major version 
    // is not 6 or we are checking for a specific minor or revision number
    // see http://blog.deconcept.com/2006/01/11/getvariable-setvariable-crash-internet-explorer-flash-6/
    if (!reqVer || ((reqVer.minor != 0 || reqVer.rev != 0) && PlayerVersion.major == reqVer.major) || PlayerVersion.major != 6 || xiInstall) {
      try{
        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.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;

