/**
 * SWFObject v1.4: Flash Player detection and embed - http://blog.deconcept.com/swfobject/
 *
 * SWFObject is (c) 2006 Geoff Stearns and is released under the MIT License:
 * http://www.opensource.org/licenses/mit-license.php
 *
 * **SWFObject is the SWF embed script formarly known as FlashObject. The name was changed for
 *   legal reasons.
 */
if(typeof deconcept=="undefined"){var deconcept=new Object();}
if(typeof deconcept.util=="undefined"){deconcept.util=new Object();}
if(typeof deconcept.SWFObjectUtil=="undefined"){deconcept.SWFObjectUtil=new Object();}
deconcept.SWFObject=function(_1,id,w,h,_5,c,_7,_8,_9,_a,_b){
if(!document.createElement||!document.getElementById){return;}
this.DETECT_KEY=_b?_b:"detectflash";
this.skipDetect=deconcept.util.getRequestParameter(this.DETECT_KEY);
this.params=new Object();
this.variables=new Object();
this.attributes=new Array();
if(_1){this.setAttribute("swf",_1);}
if(id){this.setAttribute("id",id);}
if(w){this.setAttribute("width",w);}
if(h){this.setAttribute("height",h);}
if(_5){this.setAttribute("version",new deconcept.PlayerVersion(_5.toString().split(".")));}
this.installedVer=deconcept.SWFObjectUtil.getPlayerVersion(this.getAttribute("version"),_7);
if(c){this.addParam("bgcolor",c);}
var q=_8?_8:"high";
this.addParam("quality",q);
this.setAttribute("useExpressInstall",_7);
this.setAttribute("doExpressInstall",false);
var _d=(_9)?_9:window.location;
this.setAttribute("xiRedirectUrl",_d);
this.setAttribute("redirectUrl","");
if(_a){this.setAttribute("redirectUrl",_a);}};
deconcept.SWFObject.prototype={setAttribute:function(_e,_f){
this.attributes[_e]=_f;
},getAttribute:function(_10){
return this.attributes[_10];
},addParam:function(_11,_12){
this.params[_11]=_12;
},getParams:function(){
return this.params;
},addVariable:function(_13,_14){
this.variables[_13]=_14;
},getVariable:function(_15){
return this.variables[_15];
},getVariables:function(){
return this.variables;
},getVariablePairs:function(){
var _16=new Array();
var key;
var _18=this.getVariables();
for(key in _18){
_16.push(key+"="+_18[key]);}
return _16;
},getSWFHTML:function(){
var _19="";
if(navigator.plugins&&navigator.mimeTypes&&navigator.mimeTypes.length){
if(this.getAttribute("doExpressInstall")){this.addVariable("MMplayerType","PlugIn");}
_19="<embed type=\"application/x-shockwave-flash\" src=\""+this.getAttribute("swf")+"\" width=\""+this.getAttribute("width")+"\" height=\""+this.getAttribute("height")+"\"";
_19+=" id=\""+this.getAttribute("id")+"\" name=\""+this.getAttribute("id")+"\" ";
var _1a=this.getParams();
for(var key in _1a){_19+=[key]+"=\""+_1a[key]+"\" ";}
var _1c=this.getVariablePairs().join("&");
if(_1c.length>0){_19+="flashvars=\""+_1c+"\"";}
_19+="/>";
}else{
if(this.getAttribute("doExpressInstall")){this.addVariable("MMplayerType","ActiveX");}
_19="<object id=\""+this.getAttribute("id")+"\" classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" width=\""+this.getAttribute("width")+"\" height=\""+this.getAttribute("height")+"\">";
_19+="<param name=\"movie\" value=\""+this.getAttribute("swf")+"\" />";
var _1d=this.getParams();
for(var key in _1d){_19+="<param name=\""+key+"\" value=\""+_1d[key]+"\" />";}
var _1f=this.getVariablePairs().join("&");
if(_1f.length>0){_19+="<param name=\"flashvars\" value=\""+_1f+"\" />";}
_19+="</object>";}
return _19;
},write:function(_20){
if(this.getAttribute("useExpressInstall")){
var _21=new deconcept.PlayerVersion([6,0,65]);
if(this.installedVer.versionIsValid(_21)&&!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);}}
if(this.skipDetect||this.getAttribute("doExpressInstall")||this.installedVer.versionIsValid(this.getAttribute("version"))){
var n=(typeof _20=="string")?document.getElementById(_20):_20;
n.innerHTML=this.getSWFHTML();
return true;
}else{
if(this.getAttribute("redirectUrl")!=""){document.location.replace(this.getAttribute("redirectUrl"));}}
return false;}};
deconcept.SWFObjectUtil.getPlayerVersion=function(_23,_24){
var _25=new deconcept.PlayerVersion([0,0,0]);
if(navigator.plugins&&navigator.mimeTypes.length){
var x=navigator.plugins["Shockwave Flash"];
if(x&&x.description){_25=new 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);
_25=new deconcept.PlayerVersion([i,0,0]);}}
catch(e){}
if(_23&&_25.major>_23.major){return _25;}
if(!_23||((_23.minor!=0||_23.rev!=0)&&_25.major==_23.major)||_25.major!=6||_24){
try{_25=new deconcept.PlayerVersion(axo.GetVariable("$version").split(" ")[1].split(","));}
catch(e){}}}
return _25;};
deconcept.PlayerVersion=function(_29){
this.major=parseInt(_29[0])!=null?parseInt(_29[0]):0;
this.minor=parseInt(_29[1])||0;
this.rev=parseInt(_29[2])||0;};
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;};
deconcept.util={getRequestParameter:function(_2b){
var q=document.location.search||document.location.hash;
if(q){
var _2d=q.indexOf(_2b+"=");
var _2e=(q.indexOf("&",_2d)>-1)?q.indexOf("&",_2d):q.length;
if(q.length>1&&_2d>-1){
return q.substring(q.indexOf("=",_2d)+1,_2e);
}}return "";}};
if(Array.prototype.push==null){
Array.prototype.push=function(_2f){
this[this.length]=_2f;
return this.length;};}
var getQueryParamValue=deconcept.util.getRequestParameter;
var FlashObject=deconcept.SWFObject; // for backwards compatibility
var SWFObject=deconcept.SWFObject;

/**
 * SWFFormFix v2.1.0: SWF ExternalInterface() Form Fix - http://http://www.teratechnologies.net/stevekamerman/
 *
 * SWFFormFix is (c) 2007 Steve Kamerman and is released under the MIT License:
 * http://www.opensource.org/licenses/mit-license.php
 *
 * Project sponsored by Tera Technologies - http://www.teratechnologies.net/
 */
////////////////////////////////////////////////////
////////////  Configurable options  ////////////////
////////////////////////////////////////////////////
var EnableFullAuto	= true; // set this to true and all of your flash objects will be fixed automatically
var SWFFormFixDebug = false; // set this to true to be alerted whenever a flash object is found and fixed
var NotLoadedWarning = true; // set this to true to alert the users when they try to access a function from
							 // the ExternalInterface() that isn't loaded yet
var NotLoadedMsg = "Please wait for the page to load..."; // this is the warning they will see
////////////////////////////////////////////////////
//////////  END Configurable options  //////////////
////////////////////////////////////////////////////
/**
 * Usage:
 * ------------------------------------------------------------
 * There are three ways to use SWFFormFix, FULL AUTO, Auto and Manual mode.
 * To use either method you need to include this file in the 
 * HEAD section of your page like this: 

<script src="swfformfix.js" type="text/javascript"></script>

 * 
 * NOTE: If you want Javascript to call Flash, you need to make
 * a dummy object like follows:
 
window["myFlashObject"] = new Object();

 * Put this line directly above your call to SWFObject().
 * Replace "myFlashObject" with the ID of your object (the 2nd
 * parameter you give to SWFObject() ).  This will prevent your
 * page from dieing with an error like "myFlashObject is undefined".
 * 
 * --> FULL AUTO Mode:
 * This will attempt to find every Flash Movie that you have on
 * the page and apply the fix to each of them as the page loads.
 * It will poll the page for all the objects and determine if it
 * needs to apply the fix to them every 100ms until the page is
 * completely loaded.  All you need to do to use this mode is
 * include the script in the head of your document and set the
 * "EnableFullAuto" directive to true at the top of the script.
 *
 * --> Auto Mode:
 * This will attempt to find every Flash Movie that you have on
 * the page and apply the fix to each of them.  To use auto mode
 * put the following code before the </body> tag. More specifically
 * it needs to be AFTER your last Flash object.

<script type="text/javascript">
// <![CDATA[
	SWFFormFixAuto();
// ]]>
</script>

 * 
 * --> Manual Mode:
 * This lets you fix just a single Flash object if you don't want
 * the auto mode to try to fix every Flash object on the page.
 * This mode is faster than the auto mode and may work better in
 * some situations.  To use manual mode put the following code
 * after the Flash object you want to fix, where "myFlashObject"
 * is the ID of the Flash Object:

Example for normal EMBED style:

<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="200" height="100" id="myFlashObject" align="middle">
<param name="movie" value="myMovie.swf" />
<param name="quality" value="high" />
<embed src="myMovie.swf" quality="high" width="200" height="100" name="myFlashObject" type="application/x-shockwave-flash" />
</object>

<script type="text/javascript">
// <![CDATA[
SWFFormFix("myMovieObjectName");
// ]]>
</script>

Example for SWFObject style:

<div id="flashcontent" style="width:200px;height:100px;">This is replaced by the Flash movie.</div>
<script type="text/javascript">
// <![CDATA[
// Please note that the ID that you need to use for SWFFormFix() is the second argument in SWFObject().
var so = new SWFObject("myMovie.swf", "myFlashObject","200", "100", "6.0.0", "#ffffff");
so.addParam("quality", "high");
so.write("flashcontent");
SWFFormFix("myFlashObject");
// ]]>
</script>

 * 
 * Changelog:
 * ------------------------------------------------------------
 * v2.1
 *   Fixed IE cache bug that prevents JS -> Flash after refresh.  Now SWFFormFix
 *   rebuilds all the ExternalInterface() methods that were inadvertently destroyed.
 * v2.0
 *   Added FULL AUTO mode - just enable it below and include the script!
 *   Special thanks to Geoff Stearns from deconcept and onDOMload by Aaron Barker
 * 
 * v1.0
 *   Added the SWFFormFixAuto() function, very well optimized and fast.
 * 
 * v0.2
 *   Changed helper element from <input> element to hidden <div> element
 *
 * v0.1
 *   Initial release.
 */

finished = false; // this is set to true when the body's onload is called, to stop the script
timeout = 10; // seconds to wait before giving up
starttime = new Date().getTime();
flashObjectList = Array();
fixedList = Array();
makeFuncArr = Array();
SWFFormFixAuto2 = function(){
//alert("running...");
	if(navigator.appName.toLowerCase() != "microsoft internet explorer")return true;
	var flashObjectList = document.getElementsByTagName("object");
	for(var i=0;i<flashObjectList.length;i++){
		var obj = flashObjectList[i];
		// here's all the objects on the page, now lets find the flash objects
		if(obj.getAttribute('classid') == "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"){
			var id = obj.getAttribute('id');
			var alreadyfixed = false;
			for(var c=0;c<fixedList.length;c++){if(fixedList[i] == id)alreadyfixed=true;}
			// this is a flash movie, apply the fix (unless it's already been fixed)
			if(!alreadyfixed){
				var debugtxt = '';
				for(var b in window[id]){
					// ExternalInterface() tried to add some functions to the incorrect object
					if(typeof(window[id][b])=="function"){
						// this function will need to be rebuilt when the page is done loading.
						makeFuncArr.push(Array(obj,b));
						obj[b] = function(){
							if(NotLoadedWarning)alert(NotLoadedMsg);
							return("");
						}
/*
 * it seems like this would work to copy the function, but it doesn't:
 *
 * eval('obj[b]='+window[id][b].toString());
 * 
 * This is the actual function that we're trying to copy:

function () { 
  return eval(instance.CallFunction("<invoke name=\""+name+"\" returntype=\"javascript\">" + __flash__argumentsToXML(arguments,0) + "</invoke>"));
}

 * it will fail if you copy it to the new object though because "instance" and "name" are undefined
 * Here's how to see the actual function def: document.getElementById("txt_debug").value=window[id][b];
 */
					}
				}
				window[id]=obj;
				if(SWFFormFixDebug)alert("Fixed: "+id);
			}
		}
	}
	if(!finished){
		setTimeout("SWFFormFixAuto2()", 100);
	}else{
		for(var i=0;i<makeFuncArr.length;i++){
			// this is executed after the page is loaded - it rebuilds the custom
			// ExternalInterface() functions
			SWFFormFix_rebuildExtFunc(makeFuncArr[i][0],makeFuncArr[i][1]);
		}
	}
	return true;
}
SWFFormFix_rebuildExtFunc = function(obj,functionName){
	eval('obj[functionName] = function(){return eval(this.CallFunction("<invoke name=\\"'+functionName+'\\" returntype=\\"javascript\\">" + __flash__argumentsToXML(arguments,0) + "</invoke>"));}');
	if(SWFFormFixDebug)alert("Rebuilt ExternalInterface() function: "+functionName);
}
SWFFormFixOnloadAppend = function() {
	var oldonload = window.onload;
	if (typeof window.onload != 'function') {
		window.onload = function(){
			finished=true;
		}
	} else {
		window.onload = function() {
			oldonload();
			finished=true;
		}
	}
}
SWFFormFixAuto = function(){
	if(navigator.appName.toLowerCase() != "microsoft internet explorer")return true;
	var objects = document.getElementsByTagName("object");
	if(objects.length == 0) return true;
	for(i=0;i<objects.length;i++){
		// here's all the objects on the page, now lets find the flash objects
		if(objects[i].classid == "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"){
			// this is a flash movie, apply the fix
			window[objects[i].id] = objects[i];
		}
	}
	var out = "";
	return true;
}
SWFFormFix = function(swfname){
	if(navigator.appName.toLowerCase() != "microsoft internet explorer")return false;
	var testnodename = "SWFFormFixTESTER";
	document.write('<div id="'+testnodename+'" onclick="SWFFormFixCallback(this,\''+swfname+'\');return false;" style="display:none">&nbsp;</div>');
	document.getElementById(testnodename).onclick();
}
SWFFormFixCallback = function (obj,swfname){
	var path = document;
	var error = false;
	var testnode = obj;
	while(obj = obj.parentNode){
		if(obj.nodeName.toLowerCase() == "form"){
			if(obj.name != undefined && obj.name != null && obj.name.length > 0){
				path = path.forms[obj.name];
			}else{
				alert("Error: one of your forms does not have a name!");
				error = true;
			}
		}
	}
	testnode.parentNode.removeChild(testnode);
	if(error) return false;
	window[swfname]=path[swfname];
	return true;
}
function noCacheIE(url){
	var isIE = navigator.appName.indexOf("Microsoft") != -1;
	if(!isIE)return(url);
	var newUrl = '?';
	if(url.indexOf('?') != -1)newUrl = '&';
	var now = new Date();
	var rand = Math.random().toString().substring(2,4);
	newUrl = url+newUrl+"noCacheIE="+rand+'-'+now.getTime().toString();
	return(newUrl);
}
if(EnableFullAuto){
	SWFFormFixAuto2();
	SWFFormFixOnloadAppend();
}// Flash Player Version Detection - Rev 1.5
// Detect Client Browser type
// Copyright(c) 2005-2006 Adobe Macromedia Software, LLC. All rights reserved.
var isIE  = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false;
var isWin = (navigator.appVersion.toLowerCase().indexOf("win") != -1) ? true : false;
var isOpera = (navigator.userAgent.indexOf("Opera") != -1) ? true : false;

function ControlVersion()
{
	var version;
	var axo;
	var e;

	// NOTE : new ActiveXObject(strFoo) throws an exception if strFoo isn't in the registry

	try {
		// version will be set for 7.X or greater players
		axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");
		version = axo.GetVariable("$version");
	} catch (e) {
	}

	if (!version)
	{
		try {
			// version will be set for 6.X players only
			axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");
			
			// installed player is some revision of 6.0
			// GetVariable("$version") crashes for versions 6.0.22 through 6.0.29,
			// so we have to be careful. 
			
			// default to the first public version
			version = "WIN 6,0,21,0";

			// throws if AllowScripAccess does not exist (introduced in 6.0r47)		
			axo.AllowScriptAccess = "always";

			// safe to call for 6.0r47 or greater
			version = axo.GetVariable("$version");

		} catch (e) {
		}
	}

	if (!version)
	{
		try {
			// version will be set for 4.X or 5.X player
			axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3");
			version = axo.GetVariable("$version");
		} catch (e) {
		}
	}

	if (!version)
	{
		try {
			// version will be set for 3.X player
			axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3");
			version = "WIN 3,0,18,0";
		} catch (e) {
		}
	}

	if (!version)
	{
		try {
			// version will be set for 2.X player
			axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
			version = "WIN 2,0,0,11";
		} catch (e) {
			version = -1;
		}
	}
	
	return version;
}

// JavaScript helper required to detect Flash Player PlugIn version information
function GetSwfVer(){
	// NS/Opera version >= 3 check for Flash plugin in plugin array
	var flashVer = -1;
	
	if (navigator.plugins != null && navigator.plugins.length > 0) {
		if (navigator.plugins["Shockwave Flash 2.0"] || navigator.plugins["Shockwave Flash"]) {
			var swVer2 = navigator.plugins["Shockwave Flash 2.0"] ? " 2.0" : "";
			var flashDescription = navigator.plugins["Shockwave Flash" + swVer2].description;			
			var descArray = flashDescription.split(" ");
			var tempArrayMajor = descArray[2].split(".");
			var versionMajor = tempArrayMajor[0];
			var versionMinor = tempArrayMajor[1];
			if ( descArray[3] != "" ) {
				tempArrayMinor = descArray[3].split("r");
			} else {
				tempArrayMinor = descArray[4].split("r");
			}
			var versionRevision = tempArrayMinor[1] > 0 ? tempArrayMinor[1] : 0;
			var flashVer = versionMajor + "." + versionMinor + "." + versionRevision;
		}
	}
	// MSN/WebTV 2.6 supports Flash 4
	else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.6") != -1) flashVer = 4;
	// WebTV 2.5 supports Flash 3
	else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.5") != -1) flashVer = 3;
	// older WebTV supports Flash 2
	else if (navigator.userAgent.toLowerCase().indexOf("webtv") != -1) flashVer = 2;
	else if ( isIE && isWin && !isOpera ) {
		flashVer = ControlVersion();
	}	
	return flashVer;
}

// When called with reqMajorVer, reqMinorVer, reqRevision returns true if that version or greater is available
function DetectFlashVer(reqMajorVer, reqMinorVer, reqRevision)
{
	versionStr = GetSwfVer();
	if (versionStr == -1 ) {
		return false;
	} else if (versionStr != 0) {
		if(isIE && isWin && !isOpera) {
			// Given "WIN 2,0,0,11"
			tempArray         = versionStr.split(" "); 	// ["WIN", "2,0,0,11"]
			tempString        = tempArray[1];			// "2,0,0,11"
			versionArray      = tempString.split(",");	// ['2', '0', '0', '11']
		} else {
			versionArray      = versionStr.split(".");
		}
		var versionMajor      = versionArray[0];
		var versionMinor      = versionArray[1];
		var versionRevision   = versionArray[2];

        	// is the major.revision >= requested major.revision AND the minor version >= requested minor
		if (versionMajor > parseFloat(reqMajorVer)) {
			return true;
		} else if (versionMajor == parseFloat(reqMajorVer)) {
			if (versionMinor > parseFloat(reqMinorVer))
				return true;
			else if (versionMinor == parseFloat(reqMinorVer)) {
				if (versionRevision >= parseFloat(reqRevision))
					return true;
			}
		}
		return false;
	}
}

function AC_AddExtension(src, ext)
{
  if (src.indexOf('?') != -1)
    return src.replace(/\?/, ext+'?'); 
  else
    return src + ext;
}

function AC_Generateobj(objAttrs, params, embedAttrs) 
{ 
    var str = '';
    if (isIE && isWin && !isOpera)
    {
  		str += '<object ';
  		for (var i in objAttrs)
  			str += i + '="' + objAttrs[i] + '" ';
  		for (var i in params)
  			str += '><param name="' + i + '" value="' + params[i] + '" /> ';
  		str += '></object>';
    } else {
  		str += '<embed ';
  		for (var i in embedAttrs)
  			str += i + '="' + embedAttrs[i] + '" ';
  		str += '> </embed>';
    }

    document.write(str);
}

function AC_FL_RunContent(){
  var ret = 
    AC_GetArgs
    (  arguments, ".swf", "movie", "clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
     , "application/x-shockwave-flash"
    );
  AC_Generateobj(ret.objAttrs, ret.params, ret.embedAttrs);
}

function AC_GetArgs(args, ext, srcParamName, classid, mimeType){
  var ret = new Object();
  ret.embedAttrs = new Object();
  ret.params = new Object();
  ret.objAttrs = new Object();
  for (var i=0; i < args.length; i=i+2){
    var currArg = args[i].toLowerCase();    

    switch (currArg){	
      case "classid":
        break;
      case "pluginspage":
        ret.embedAttrs[args[i]] = args[i+1];
        break;
      case "src":
      case "movie":	
        args[i+1] = AC_AddExtension(args[i+1], ext);
        ret.embedAttrs["src"] = args[i+1];
        ret.params[srcParamName] = args[i+1];
        break;
      case "onafterupdate":
      case "onbeforeupdate":
      case "onblur":
      case "oncellchange":
      case "onclick":
      case "ondblClick":
      case "ondrag":
      case "ondragend":
      case "ondragenter":
      case "ondragleave":
      case "ondragover":
      case "ondrop":
      case "onfinish":
      case "onfocus":
      case "onhelp":
      case "onmousedown":
      case "onmouseup":
      case "onmouseover":
      case "onmousemove":
      case "onmouseout":
      case "onkeypress":
      case "onkeydown":
      case "onkeyup":
      case "onload":
      case "onlosecapture":
      case "onpropertychange":
      case "onreadystatechange":
      case "onrowsdelete":
      case "onrowenter":
      case "onrowexit":
      case "onrowsinserted":
      case "onstart":
      case "onscroll":
      case "onbeforeeditfocus":
      case "onactivate":
      case "onbeforedeactivate":
      case "ondeactivate":
      case "type":
      case "codebase":
        ret.objAttrs[args[i]] = args[i+1];
        break;
      case "id":
      case "width":
      case "height":
      case "align":
      case "vspace": 
      case "hspace":
      case "class":
      case "title":
      case "accesskey":
      case "name":
      case "tabindex":
        ret.embedAttrs[args[i]] = ret.objAttrs[args[i]] = args[i+1];
        break;
      default:
        ret.embedAttrs[args[i]] = ret.params[args[i]] = args[i+1];
    }
  }
  ret.objAttrs["classid"] = classid;
  if (mimeType) ret.embedAttrs["type"] = mimeType;
  return ret;
}


//Code block from HPFlex.ascx
    function DetectFlash()
    {
    // -----------------------------------------------------------------------------
    // Globals
    // Major version of Flash required
    var requiredMajorVersion = 9;
    // Minor version of Flash required
    var requiredMinorVersion = 0;
    // Minor version of Flash required
    var requiredRevision = 0;
    // -----------------------------------------------------------------------------
    // -->
    

    
        var hasProductInstall = DetectFlashVer(6, 0, 65);

       
        var hasRequestedVersion = DetectFlashVer(requiredMajorVersion, requiredMinorVersion, requiredRevision);


        // Check to see if a player with Flash Product Install is available and the version does not meet the requirements for playback
        if ( hasProductInstall && !hasRequestedVersion ) {
            // MMdoctitle is the stored document.title value used by the installation process to close the window that started the process
            // This is necessary in order to close browser windows that are still utilizing the older version of the player after installation has completed
            // DO NOT MODIFY THE FOLLOWING FOUR LINES
            // Location visited after installation is complete if installation is required
            
            var MMPlayerType = (isIE == true) ? "ActiveX" : "PlugIn";
            var MMredirectURL = window.location;
            document.title = document.title.slice(0, 47) + " - Flash Player Installation";
            var MMdoctitle = document.title;

            window["ppng_product_swf"] = new Object();
            var so = new SWFObject("/swf/ppng_product_swf.swf", "ppng_product_swf", "1000", "270", "9" ,"#ffffff");
            so.addParam("scale", "noscale");
            so.write("ppngHomeFlex");
            
        } else if (hasRequestedVersion) {
            // if we've detected an acceptable version
            // embed the Flash Content SWF when all tests are passed
               
            window["ppng_product_swf"] = new Object();
            var so = new SWFObject("/swf/ppng_product_swf.swf", "ppng_product_swf", "1000", "270", "9" ,"#ffffff");
            so.addParam("scale", "noscale");
            so.write("ppngHomeFlex");
        } else {  // flash is too old or we can't detect the plugin
            var alternateContent = 'PPG Quick catalog : '
            + 'This content requires the Adobe Flash Player. '
            + '<a href=http://www.adobe.com/go/getflash/>Get Flash</a>';
            document.write(alternateContent);  // insert non-flash content
        }
        }// $Revision: 1.49 $
// Vars
Vars = function(qStr) {
	this.numVars = 0;
	if(qStr != null) {
		var nameValue, name;
		var pairs = qStr.split('&');
		var pairLen = pairs.length;
		for(var i = 0; i < pairLen; i++) {
			var pair = pairs[i];
			if( (pair.indexOf('=')!= -1) && (pair.length > 3) ) {
				var nameValue = pair.split('=');
				var name = nameValue[0];
				var value = nameValue[1];
				if(this[name] == null && name.length > 0 && value.length > 0) { 
					this[name] = value;
					this.numVars++;
				}
			}
		} 
	}
}
Vars.prototype.toString = function(pre) {
	var result = '';
	if(pre == null) { pre = ''; }
	for(var i in this) {
		if(this[i] != null && typeof(this[i]) != 'object' && typeof(this[i]) != 'function' && i != 'numVars') {
			result += pre + i + '=' + this[i] + '&';
		}
	}
	if(result.length > 0) result = result.substr(0, result.length-1);
	return result;
}
function getSearch(wRef) {
	var searchStr = '';
	if(wRef.location.search.length > 1) {
		searchStr = new String(wRef.location.search);
		searchStr = searchStr.substring(1, searchStr.length);
	}
	return searchStr;
}
var lc_id = Math.floor(Math.random() * 100000).toString(16);
if (this != top)
{
	top.Vars = Vars;
	top.getSearch = getSearch;
	top.lc_id = lc_id;
}
// JScript File

var headAlrt="PPG Alert :\n\n" ;
var headcnfrm ="PPG Confirm :\n\n" ; 
			
function Jalert(Msg)
{
    alert(headAlrt + Msg);
}
function Jconfirm(Msg)
{
    return confirm(headcnfrm + Msg);
}
 String.prototype.trim = function() { return this.replace(/^\s+|\s+$/, ''); };
 function txtEmpty(ctlID)
 {                       
    var TemCtl = document.getElementById(ctlID) ;                   
    if (TemCtl.value.trim() == "")
    return false;
    else
    return true;
 }
function SectorValidation(ctlID)
{
    var TemCtl = document.getElementById(ctlID).value ;                   
    if (TemCtl.value.trim() == "please select sector")
    return false;
    else
    return true;
}
function SubSectorValidation(ctlID)
{
    var TemCtl = document.getElementById(ctlID) ;                   
    if (TemCtl.value.trim() == "Please select a subsector")
    return false;
    else
    return true;
}
function txtChkPass(ctlID,ctlId2)
{                       
    var TemCtl = document.getElementById(ctlID) ;  
    var tempct2= document.getElementById(ctlId2) ;                  
    if (TemCtl.value.trim() != tempct2.value.trim())
    return false;
    else
    return true;
}
function checkCheckBoxes(ctlId1)
{
    var TemCtl=document.getElementById(ctlId1);                   
    if (TemCtl.checked == false)
        {
            return false;
        }
        else
        {
            return true;
        }    
}

//codeblock from bannerblurb.ascx
 var Tot_Txt = 0 ,  Column_Cnt = 0 ,intervalle=10000;var numbre_total_txt;

            var ColCnt ;

            var txt = new Array();

            var col = new Array();

            

            function boucle_images1()

            {

                  txt[0]='World class online photo printing,\<br \> gifting and sharing';
                  txt[1]='Have fun while preserving\<br \> your photo memories';
                  txt[2]='Upload, Share, Print, Albums,\<br \> Slideshows, Mobile features and more';
                  txt[3]='Hang on and we promise you\<br \> loads of wonderful experiences…..';
                  txt[4]='Calling all Digital camera owners, \<br \> Mobile camera owners';
                  txt[5]='Wedding album makers, \<br \> creative designers and card makers';   
                  //txt[6]='Photo enthusiasts who likes to\<br \> upload their photos\<br \> to a central secure server (anytime, anywhere access)';
                  txt[6]='Organize, edit, share prints of multiple sizes, textures and formats\<br \> ';
                  txt[7]='Photographers and photo enthusiasts, \<br \> mini color lab owners';
                  txt[8]='Photo art creators, Small and \<br \> large format photo finishers';
                  txt[9]='Spread the joy of sharing fond memories and cherished moments of life';
                  txt[10]='Import photos from Flickr & Picasa \<br \> Win exciting awards at Photo Contest';
                  
                  col[0]='BBB';
                          

                  numbre_total_txt = 10 ;
                  ColCnt = 1 ;
                  txtrotate();
            }
            

            function txtrotate()
            {
                  Tot_Txt = rnd(numbre_total_txt);
                  Column_Cnt = rnd(ColCnt);
                  if(Tot_Txt == numbre_total_txt)
                  Tot_Txt=0 ;
                  if(Column_Cnt == ColCnt)
                  Column_Cnt = 0 ;
                  document.getElementById('dvBB').innerHTML =  txt[Tot_Txt];
                  document.getElementById('dvBB').className = col[Column_Cnt];
                  setTimeout('txtrotate()',intervalle) ;
            }
            boucle_images1();
            
            function rnd(max)
            { 
                 var rndnum = max * Math.random() ;
                  rndnum = Math.ceil (rndnum) ;
                  return rndnum ;
            }
            
            function mfnPPNGBannerFlashCheck()
            {
            // Version check for the Flash Player that has the ability to start Player Product Install (6.0r65)
                    var hasProductInstall = DetectFlashVer(6, 0, 65);

                    // Version check based upon the values defined in globals
                    var hasRequestedVersion = DetectFlashVer(requiredMajorVersion, requiredMinorVersion, requiredRevision);

                    // Check to see if a player with Flash Product Install is available and the version does not meet the requirements for playback
                    if ( hasProductInstall && !hasRequestedVersion ) {
	                    // MMdoctitle is the stored document.title value used by the installation process to close the window that started the process
	                    // This is necessary in order to close browser windows that are still utilizing the older version of the player after installation has completed
	                    // DO NOT MODIFY THE FOLLOWING FOUR LINES
	                    // Location visited after installation is complete if installation is required
	                    var MMPlayerType = (isIE == true) ? "ActiveX" : "PlugIn";
	                    var MMredirectURL = window.location;
                        document.title = document.title.slice(0, 47) + " - Flash Player Installation";
                        var MMdoctitle = document.title;
                    } else if (hasRequestedVersion) {
	                    // if we've detected an acceptable version
	                    // embed the Flash Content SWF when all tests are passed
			                     window["PPNG_banner"] = new Object();
                                               var so = new SWFObject("PPNG_banner.swf", "PPNG_banner", "922", "270", "6" ,"#ffffff");
                                               so.addParam("scale", "noscale");
                                               so.write("flashBan");
                    	
                      }
            }
            
            function mfnPPNGCustomizerFlashCheck()
            {
            // Version check for the Flash Player that has the ability to start Player Product Install (6.0r65)
                    var hasProductInstall = DetectFlashVer(6, 0, 65);

                    // Version check based upon the values defined in globals
                    var hasRequestedVersion = DetectFlashVer(requiredMajorVersion, requiredMinorVersion, requiredRevision);

                    // Check to see if a player with Flash Product Install is available and the version does not meet the requirements for playback
                    if ( hasProductInstall && !hasRequestedVersion ) {
	                    // MMdoctitle is the stored document.title value used by the installation process to close the window that started the process
	                    // This is necessary in order to close browser windows that are still utilizing the older version of the player after installation has completed
	                    // DO NOT MODIFY THE FOLLOWING FOUR LINES
	                    // Location visited after installation is complete if installation is required
	                    var MMPlayerType = (isIE == true) ? "ActiveX" : "PlugIn";
	                    var MMredirectURL = window.location;
                        document.title = document.title.slice(0, 47) + " - Flash Player Installation";
                        var MMdoctitle = document.title;
                    } else if (hasRequestedVersion) {
	                    // if we've detected an acceptable version
	                    // embed the Flash Content SWF when all tests are passed
			                     window["ppngCustomizer"] = new Object();
                                               var so = new SWFObject("swf/ppngCustomizer.swf", "ppngCustomizer", "930", "265", "6" ,"#ffffff");
                                               so.addParam("scale", "noscale");
                                               so.write("flex");
                    	
                      }
            }
//email check start

function basicCheck(emails)
{
    var skip=false;
     for(i=0;i<emails.length;i++)
      {
                    if(emails[i].indexOf(" ")==0)
                    {
                        emails[i] = emails[i].substring(1);
                        return false;
                    }
                    if(emails[i].indexOf(",")!=-1)
                    {
                        alert("Please separate multiple addresses with a ; (semicolon)");
                        skip=true;
                        break;
    
                    }
                    if(!CheckEmail(emails[i]))
                    {
                        skip=true;
                        break;
                    }
                    
      }
      if(!skip)
      {
        return true;
      }
      else
      {
        return false;
      }
}

function CheckEmail(email) 
{

    if (email == "") 
    {
        Jalert("Please enter email ID");
        return false;
    }

    if (email.indexOf(" ") != -1) 
    {
        Jalert("No spaces are allowed");
        return false;
    }

    if (email.indexOf("@") == -1) 
    {
         Jalert("Email ID should have @");
         return false;
    }

    if (email.indexOf("@") < 1) 
    {
        Jalert("An email id is invalid");
        return false;
    }

    if (email.indexOf("@") != email.lastIndexOf("@")) 
    {
        Jalert("An email address must contain one @");
        return false;
    }

    if (email.indexOf(".") == -1) 
    {
        Jalert("Email ID should have . (dot)");
        return false;
    }

    if (email.indexOf(".") >= (email.length-2)) 
    {
        Jalert("Email ID is invalid");
        return false;
    }

    if ((email.indexOf("@") - email.lastIndexOf(".")) > 0) 
    {
       Jalert("An email id is invalid");
       return false;
    }

    return true;
}

function trim(inputString) {

   // Removes leading and trailing spaces from the passed string. Also removes
   // consecutive spaces and replaces it with one space. If something besides
   // a string is passed in (null, custom object, etc.) then return the input.
   if (typeof inputString != "string") { return inputString; }
   var retValue = inputString;
   var ch = retValue.substring(0, 1);
   while (ch == " ") { // Check for spaces at the beginning of the string
      retValue = retValue.substring(1, retValue.length);
      ch = retValue.substring(0, 1);
   }
   ch = retValue.substring(retValue.length-1, retValue.length);
   while (ch == " ") { // Check for spaces at the end of the string
      retValue = retValue.substring(0, retValue.length-1);
      ch = retValue.substring(retValue.length-1, retValue.length);
   }
   while (retValue.indexOf("  ") != -1) { // Note that there are two spaces in the string - look for multiple spaces within the string
      retValue = retValue.substring(0, retValue.indexOf("  ")) + retValue.substring(retValue.indexOf("  ")+1, retValue.length); // Again, there are two spaces in each of the strings
   }
   return retValue; // Return the trimmed string back to the user
   Jalert(retValue);
} 

//email check function ends
function TAFSub()
{                 
    if(!txtEmpty('ctl00_Header_QA_TAF_txtNm'))
    {        
        Jalert("Enter name");
        document.getElementById('ctl00_Header_QA_TAF_txtNm').focus();
        return false;
        
    }  

    var emails=document.getElementById('ctl00_Header_QA_TAF_txtYourEMailID').value.split(';');    
    if(!basicCheck(emails))
    {
       // Jalert("Email Invalid or empty");
        document.getElementById('ctl00_Header_QA_TAF_txtYourEMailID').focus();
        return false;
    }
    var friendEmails=document.getElementById('ctl00_Header_QA_TAF_txtFrdEmail').value.split(';');
    var friendEmails1=trim(friendEmails);    
    if(!basicCheck(friendEmails))
    {
        Jalert("Friend Email Invalid or empty");
        document.getElementById('ctl00_Header_QA_TAF_txtFrdEmail').focus();
        return false;
    }
    
    //mobile number
    if(!txtEmpty('ctl00_Header_QA_TAF_txtMobNm'))
    {
       // Jalert("Mobile Number Empty");
        document.getElementById('ctl00_Header_QA_TAF_txtMobNm').focus();
        Jalert("Enter valid phone number");
        return false;
    }
    
    var mobNumbers=document.getElementById('ctl00_Header_QA_TAF_txtMobNm').value.split(';');
    if(!checkMobNum(mobNumbers))
    { 
        document.getElementById('ctl00_Header_QA_TAF_txtMobNm').focus();  
        return false;
    }
    if(!txtEmpty('ctl00_Header_QA_TAF_txtYourMsg'))
    {
        document.getElementById('ctl00_Header_QA_TAF_txtYourMsg').focus();
        Jalert("Enter your message");
        return false;
    }    
     if(!txtEmpty('ctl00_Header_QA_TAF_txtCode'))
    {
        document.getElementById('ctl00_Header_QA_TAF_txtCode').focus();
        Jalert("Enter text below");
        return false;
    }    
    if(document.getElementById('ctl00_Header_QA_TAF_txtYourMsg').value.length > 250)
    {
        Jalert("Maximum 250 characters only");
        document.getElementById('ctl00_Header_QA_TAF_txtYourMsg').focus();
        return false;
    }
     document.getElementById('TAFRecLdr').style.display = "block";     
     document.getElementById('divFailure').style.display = "none";    
     tellafriend.instaf(document.getElementById('ctl00_Header_QA_TAF_txtNm').value,document.getElementById('ctl00_Header_QA_TAF_txtYourEMailID').value,document.getElementById('ctl00_Header_QA_TAF_txtFrdEmail').value,document.getElementById('ctl00_Header_QA_TAF_txtMobNm').value,document.getElementById('ctl00_Header_QA_TAF_txtYourMsg').value,document.getElementById("ctl00_Header_QA_TAF_txtCode").value, onInsTAFSuccess,onInsTAFTimeout,onInsTAFFailure);     
     //document.getElementById('RecLdr').style.display = "none";
    return false;     
 }
 function TAFClear()
 {
    document.getElementById('ctl00_Header_QA_TAF_txtNm').value = "";
    document.getElementById('ctl00_Header_QA_TAF_txtYourEMailID').value = "";
    document.getElementById('ctl00_Header_QA_TAF_txtFrdEmail').value = "";
    document.getElementById('ctl00_Header_QA_TAF_txtMobNm').value = "";
    document.getElementById('ctl00_Header_QA_TAF_txtYourMsg').value = "";
    document.getElementById("ctl00_Header_QA_TAF_txtCode").value = "";
 }
 function onInsTAFSuccess(result, eventArgs)
{
    //document.getElementById('result').style.display = "block";            
    if (result =="1")
    {
        document.getElementById('divSuccess').style.display = "block";        
        document.getElementById('TAFRecLdr').style.display = "none";
        document.getElementById("divTAFInvalidSecret").style.display = "none";        
        document.getElementById('TAFRecLdr').style.display = "none";
        //document.getElementById('imgJobberVoiceBoxWellLoader').style.display = "none";
        if (navigator.appName.indexOf("Microsoft Internet Explorer")>(-1))
        { 
            document.getElementById('FlexGallery').style.display="block";
            document.getElementById('flexCus').style.display="block";
        } 
        document.getElementById('mainDivFlex').style.visibility="hidden";
        TAFClear();
     }     
     if (result=="-2")
     {
            document.getElementById('divFailure').style.display = "none";
            document.getElementById('divSuccess').style.display = "none";
            document.getElementById('TAFRecLdr').style.display = "none";
            document.getElementById("divTAFInvalidSecret").style.display = "block"; 
            if (navigator.appName.indexOf("Microsoft Internet Explorer")>(-1))
            { 
                document.getElementById('FlexGallery').style.display="none";
                document.getElementById('flexCus').style.display="none";
            } 
             document.getElementById('mainDivFlex').style.visibility="visible";

     }
     
     return false;
}  
function ShowTafclose(mode)
{
    if (navigator.appName.indexOf("Microsoft Internet Explorer")>(-1))
     { 
         document.getElementById('FlexGallery').style.display="block";
         document.getElementById('flexCus').style.display="block";
      } 
                  document.getElementById('mainDivFlex').style.visibility="visible";

      return false;
}
function ShowTafModalpopup(mode)
{
   //$find('ctl00_Footer_mpTAF').show(); ctl00_Header_QA_mpTAF 
    document.getElementById('ctl00_Header_QA_TAF_txtNm').value = "";
    document.getElementById('ctl00_Header_QA_TAF_txtYourEMailID').value = "";
    document.getElementById('ctl00_Header_QA_TAF_txtFrdEmail').value = "";
    document.getElementById('ctl00_Header_QA_TAF_txtMobNm').value = "";
    document.getElementById('ctl00_Header_QA_TAF_txtYourMsg').value = "";
    document.getElementById("ctl00_Header_QA_TAF_txtCode").value = "";
   $find('ctl00_Header_QA_mpTAF').show();
   document.getElementById('ctl00_Header_QA_TAF_txtNm').focus();
   //if (navigator.appName.indexOf("Microsoft Internet Explorer")>(-1))
     //{ 
         //document.getElementById('FlexGallery').style.display="none";
         //document.getElementById('flexCus').style.display="none";
      //} 
      document.getElementById('FlexGallery').style.visibility="hidden";
         document.getElementById('flexCus').style.visibility="hidden";
                     document.getElementById('mainDivFlex').style.visibility="hidden";

}
function TAFhide()
{ 
    document.getElementById('FlexGallery').style.visibility="visible";
    document.getElementById('flexCus').style.visibility="visible";
                document.getElementById('mainDivFlex').style.visibility="visible";

    document.getElementById('divSuccess').style.display = "none";
    return false;
}

function ShowTafclose()
{
  document.getElementById('FlexGallery').style.visibility="visible";
    document.getElementById('flexCus').style.visibility="visible";
                document.getElementById('mainDivFlex').style.visibility="visible";

    document.getElementById('divSuccess').style.display = "none";
    return false;
}

function onInsTAFTimeout(result) {
}

function onInsTAFFailure(result)  {
}

String.prototype.trim = function() { return this.replace(/^\s+|\s+$/, ''); };

function checkMobNum(mobNumbers)
{
        if(mobNumbers.length == 0)
        {
                 Jalert("Please Enter Mobile Number");
                 return false;
        }
        if(mobNumbers.length>10)
        {
                 Jalert("Please Enter a Valid Mobile Number");
                 return false;
        }
        else if(mobNumbers.indexOf(",")!=-1)
        {
                 Jalert("Please seperate mobile numbers with a ; (semicolon)");
                 return false;

        }
        else if(mobNumbers.indexOf(" ")!=-1)
        {
                 Jalert("Please seperate mobile numbers with a ; (semicolon)");
                 return false;
        }
        else
        {
                
                for(i=0;i<mobNumbers.length;i++)
                {
                        res = checkInternationalPhone(mobNumbers[i]);
                        if(res == false)
                        {
                                Jalert("Please enter valid mobile number");
                                return false;
                         }
                }
        }
        return true;
}
function checkInternationalPhone(strPhone)
{
    var digits = "0123456789";
    var validWorldPhoneChars = "+";
    var minDigitsInIPhoneNumber = 10;
    s=stripCharsInBag(strPhone,validWorldPhoneChars);
    return (isInteger(s) && s.length == minDigitsInIPhoneNumber);
}

function stripCharsInBag(s, bag)
{   var i;
    var returnString = "";
    // Search through string's characters one by one.
    // If character is not in bag, append to returnString.
    for (i = 0; i < s.length; i++)
    {
        // Check that current character isn't whitespace.
        var c = s.charAt(i);
        if (bag.indexOf(c) == -1) returnString += c;
    }
    return returnString;
}

function isInteger(s)
{   var i;
    for (i = 0; i < s.length; i++)
    {
        // Check that current character is number.
        var c = s.charAt(i);
        if (((c < "0") || (c > "9"))) return false;
    }
    // All characters are numbers.
    return true;
}// JScript File

function SignInModalPopUp()
{
      
    //document.getElementById('txtName').focus();
    document.getElementById('txtName').value="";    
    document.getElementById('txtEmail').value="";
    document.getElementById('txtLNm').value="";
    document.getElementById('txtCreatePW').value="";
    document.getElementById('txtConfPW').value="";
    document.getElementById('txtJPHandphone').value="";
    document.getElementById('chkNewLetter0').checked=false;
    document.getElementById('chkNewLetter').checked=false;
    $find('modpopSignUp').show();
    document.getElementById('divWizardStep2a').style.display="block";
    document.getElementById('divWizardStep2b').style.display="none";
    document.getElementById('txtName').focus();
    //if (navigator.appName.indexOf("Microsoft Internet Explorer")>(-1))
     //{ 
         document.getElementById('FlexGallery').style.visibility="hidden";
         document.getElementById('flexCus').style.visibility="hidden";
         document.getElementById('mainDivFlex').style.visibility="hidden";
      //} 
    return false;
}
function SignUpModalPopUp()
{

    //document.getElementById('txtUserName').focus();
    document.getElementById('txtUserName').value="";
    document.getElementById('txtPW').value="";
    
    $find('modpopSignUp').show();
    document.getElementById('divWizardStep2a').style.display="none";
    document.getElementById('divWizardStep2b').style.display="block";
    document.getElementById('txtUserName').focus();
    //if (navigator.appName.indexOf("Microsoft Internet Explorer")>(-1))
     //{ 
         //document.getElementById('FlexGallery').style.visibility="hidden";
         //document.getElementById('flexCus').style.visibility="hidden";
         document.getElementById('FlexGallery').style.visibility="hidden";
         document.getElementById('flexCus').style.visibility="hidden";
         document.getElementById('mainDivFlex').style.visibility="hidden";
      //} 
    return false;
}

//for preauthenticated pop up sign in
function ForgetPwdPreAuthenticated()
{
    document.getElementById('cnfrm').style.display="none";
    document.getElementById('divFpwdLdr').style.display="none";
    document.getElementById('idCon').style.display="block";
    $find('mpopforget').show();
    document.getElementById('ctl00_signUp_txtUserid').focus();
    document.getElementById('ctl00_signUp_txtUserid').value="";
    document.getElementById('FlexGallery').style.visibility="hidden";
    document.getElementById('flexCus').style.visibility="hidden";
    document.getElementById('mainDivFlex').style.visibility="hidden";
//    return false;
}
function SignUpModalPopUp1()
{
    document.getElementById('txtUserName').value="";
    document.getElementById('txtPW').value="";
    document.getElementById('ctl00_cph_divSignupDiv').style.display="block";
    document.getElementById('ctl00_cph_divSignINDiv').style.display="none";

    document.getElementById('txtUserName').focus();
    document.getElementById('FlexGallery').style.visibility="hidden";
    document.getElementById('flexCus').style.visibility="hidden";
    document.getElementById('mainDivFlex').style.visibility="hidden";
}
function SignInModalPopUp1()
{
    document.getElementById('txtUserName').value="";
    document.getElementById('txtPW').value="";
    document.getElementById('ctl00_cph_divSignupDiv').style.display="none";
    document.getElementById('ctl00_cph_divSignINDiv').style.display="block";

    document.getElementById('txtUserName').focus();
    document.getElementById('FlexGallery').style.visibility="hidden";
    document.getElementById('flexCus').style.visibility="hidden";
    document.getElementById('mainDivFlex').style.visibility="hidden";
}

//ends here


function HideFlexPopUp()
{
    //if (navigator.appName.indexOf("Microsoft Internet Explorer")>(-1))
     //{ 
         //document.getElementById('FlexGallery').style.visibility="visible";
         //document.getElementById('flexCus').style.visibility="visible";
         document.getElementById('FlexGallery').style.visibility="visible";
         document.getElementById('flexCus').style.visibility="visible";
         document.getElementById('mainDivFlex').style.visibility="hidden";
      //} 
    return false;
}

function ForgetPwdModalPopUp()
{
    $find('modpopSignUp').hide();
    document.getElementById('cnfrm').style.display="none";
    document.getElementById('divFpwdLdr').style.display="none";
    document.getElementById('idCon').style.display="block";
    $find('mpopforget').show();
     document.getElementById('ctl00_signUp_txtUserid').focus();
    document.getElementById('ctl00_signUp_txtUserid').value="";
   //if (navigator.appName.indexOf("Microsoft Internet Explorer")>(-1))
     //{ 
         document.getElementById('FlexGallery').style.visibility="hidden";
         document.getElementById('flexCus').style.visibility="hidden";
         document.getElementById('mainDivFlex').style.visibility="hidden";
      //} 
    return false;
}


/* SatS on Dec_05_2007  */

function mfnLoginLogout()
{    
//Commented for now
    var DivLogout =  document.getElementById("divLogout");
    var DivLoader =  document.getElementById("divLogoutLoader");
    DivLoader.style.display = "block";          
    DivLogout.style.display = "none";
    SignUp.gfnLoginLogout("Login", onLoginLogoutSuccess, onLoginLogoutTimeout, onLoginLogoutFailure);             
    //if (navigator.appName.indexOf("Microsoft Internet Explorer")>(-1))
    //{ 
        document.getElementById('FlexGallery').style.visibility="visible";
        document.getElementById('flexCus').style.visibility="visible";
        document.getElementById('mainDivFlex').style.visibility="visible";
        
        
     //} 
  }

function onShowUsrOption()
{
    try
    {  
          document.getElementById("ctl00_lnkUpload").href = "/myspace/createalbum.aspx" ;  
          if(txtEmpty('ctl00_hdnToRedirect'))
          {
             var lstrToRedirect = document.getElementById('ctl00_hdnToRedirect').value;
             document.getElementById('ctl00_hdnToRedirect').value = "";
             window.location = lstrToRedirect;            
          }
             
     }
    catch(ex)
    {
      alert(ex);
    }   
}
/*          END OF STATEMENT        */
function validationSignup()
{     if(!txtEmpty('txtName'))
    {        
        Jalert("Enter first name");
        document.getElementById('txtName').focus();
        return false;
    }
    
//    if(isNaN(txtName.value))
//   {
//     Jalert("Invalid data format.\n\nOnly numbers are allowed.");
//     document.getElementById('txtName').focus();
//     return false;
//   }
   
     if(document.getElementById('txtName').value.length < 4)
    {
        Jalert("Enter a name with atleast four characters");
        document.getElementById('txtName').focus();        
        return false;   
    }     
     if(!txtEmpty('txtEmail'))
    {
        document.getElementById('txtEmail').focus();
        Jalert("Enter a valid email id");
        return false;
    }
    
//    if(document.getElementById('txtEmail').value.length > 30)
//    {
//        Jalert("Email should not exceed more than 30 characters");
//        document.getElementById('txtEmail').focus();        
//        return false;   
//    }     

    if (!/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(document.getElementById('txtEmail').value))
    {
        Jalert("Invalid E-mail Address! Please re-enter.");
        document.getElementById('txtEmail').focus();
        return false;
    }       
     if(!txtEmpty('txtCreatePW'))
    {        
        Jalert("Enter password");
        document.getElementById('txtCreatePW').focus();
        return false;
    }
    if(document.getElementById('txtCreatePW').value.length < 4)
    {
        Jalert("Enter a password with atleast four characters");
        document.getElementById('txtCreatePW').focus();        
        return false;   
    }
      
    if(!txtEmpty('txtConfPW'))
    {        
        Jalert("Enter confirm password");
        document.getElementById('txtConfPW').focus();
        return false;
    }
    if(!txtChkPass('txtCreatePW','txtConfPW'))
    {        
        Jalert("Password and confirm password must be equal");
        document.getElementById('txtCreatePW').focus();
        return false;
    }        
    if(!checkCheckBoxes('chkNewLetter'))
    {        
        Jalert("Terms and conditions should be accepted to enter");
        document.getElementById('chkNewLetter').focus();
        return false;
    }   
  
    signup.gfnSignUp( document.getElementById('txtEmail').value,document.getElementById('txtName').value,"",document.getElementById('txtCreatePW').value,false,false,document.getElementById('chkNewLetter').checked,document.getElementById('txtJPHandphone').value, onfsignUPSuccess, onfSignUpLoadTimeout,onfSignUpFailure);   
    return false;
}
function onfsignUPSuccess(result, eventArgs)
{
//     mfnLoginLogout() ;
//     SUPopCancel() ;
//     onShowUsrOption(result) ;
    if (result=="-1")
    {
        var DivLoader =  document.getElementById("divSignUpMessage");
        DivLoader.style.display = "block" ; 
        document.getElementById("ctl00_HPHeader_QA_signin").style.display="none";
        document.getElementById("ctl00_HPHeader_QA_signout").style.display="block"; 
        document.getElementById("ctl00_HPHeader_QA_imgJoin").style.display="none";
        //document.getElementById("ctl00_cph_rhsjoin_divRHSSignin").style.display = "block";
        //document.getElementById("ctl00_cph_rhsjoin_divRHSCloud").style.display = "none";
        //if (navigator.appName.indexOf("Microsoft Internet Explorer")>(-1))
        //{ 
            document.getElementById('FlexGallery').style.visibility="hidden";
            document.getElementById('flexCus').style.visibility="hidden";
            document.getElementById('mainDivFlex').style.visibility="hidden";
        //} 
    }
    else
    {
        $find('modpopSignUp').hide();
        var DivSignUpWell =  document.getElementById("divWizardStep2b");
        DivSignUpWell.style.display = "block";         
        document.getElementById("divAccOpt").innerHTML = " <a id='lnkSignout' runat='server' href='/signout.aspx' style='border-style: none;'><img src='/images/HImages/ppng-signOut.gif' alt='Sign out' /></a>";
        //document.getElementById("ctl00_cph_rhsjoin_divRHSSignin").style.display = "none";
        //document.getElementById("ctl00_cph_rhsjoin_divRHSCloud").style.display = "block";
        //if (navigator.appName.indexOf("Microsoft Internet Explorer")>(-1))
        //{ 
            document.getElementById('FlexGallery').style.visibility="visible";
            document.getElementById('flexCus').style.visibility="visible";
            document.getElementById('mainDivFlex').style.visibility="visible";
        //} 
        signup.gfnGetUserFirstName(onSignUpUserFirstNameSuccess, onfSignUpLoadTimeout,onfSignUpFailure);   
    }
    
}
function onfSignUpLoadTimeout(result)
{
 
}

function onfSignUpFailure(result)
{
    var DivLoader =  document.getElementById("divSignUpMessage");
    DivLoader.style.display = "block" ;    
}

function mfnSigninFromPhotoContest(o)
{
    signup.gfnSignIn(o.username,o.password, onSignINSuccess, onSignInLoadTimeout,onSignInFailure);  
   
}

/*this is for signIn module  */
function validationSignIn()
{
    if(!txtEmpty('txtUserName'))
    {        
        Jalert("Enter your email id");
        document.getElementById('txtUserName').focus();
        return false;
    }
    
    if (!/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(document.getElementById('txtUserName').value))
    {
        Jalert("Invalid E-mail Address! Please re-enter.");
        document.getElementById('txtUserName').focus();
        return false;
    }
    
    if(document.getElementById('txtPW').value.length < 4)
    {
        Jalert("Enter password");
        document.getElementById('txtPW').focus();        
        return false;   
    }
     signup.gfnSignIn(document.getElementById('txtUserName').value,document.getElementById('txtPW').value, onSignINSuccess, onSignInLoadTimeout,onSignInFailure);   
    
     return false;
}
function onSignINSuccess(result, eventArgs)
{
    if (result=="-1")
    {
        var DivLoader =  document.getElementById("divppngLogin");
        DivLoader.style.display = "block" ; 
        var spanMsg=document.getElementById("lnkppngLogin");
        spanMsg.innerHTML= "Invalid user details";       
        //document.getElementById("ctl00_cph_rhsjoin_divRHSCloud").style.display = "none";
        //document.getElementById("ctl00_cph_rhsjoin_divRHSSignin").style.display = "block";
        // if (navigator.appName.indexOf("Microsoft Internet Explorer")>(-1))
        //{ 
            document.getElementById('FlexGallery').style.visibility="hidden";
            document.getElementById('flexCus').style.visibility="hidden";
            document.getElementById('mainDivFlex').style.visibility="hidden";
        //} 
    }
    else
    {
    
        $find('modpopSignUp').hide();
        //Jalert('Check1');
         //if (navigator.appName.indexOf("Microsoft Internet Explorer")>(-1))
      // { 
       
            document.getElementById('FlexGallery').style.visibility="visible";
            document.getElementById('flexCus').style.visibility="visible";
            document.getElementById('mainDivFlex').style.visibility="visible";
      //} 
         
        var DivLoader =  document.getElementById("divppngLogin");
        DivLoader.style.display = "none" ; 
         var DivSignUpWell =  document.getElementById("divWizardStep2a");
         DivSignUpWell.style.display = "block";   
        document.getElementById("divAccOpt").innerHTML = " <a id='lnkSignout' runat='server' href='/signout.aspx' style='border-style: none;'><img src='/images/HImages/ppng-signOut.gif' alt='Sign out' /></a>";
        //document.getElementById("ctl00_cph_rhsjoin_divRHSCloud").style.display = "block";
        //document.getElementById("ctl00_cph_rhsjoin_divRHSSignin").style.display = "none";
        signup.gfnGetUserFirstName(onSignUpUserFirstNameSuccess, onfSignUpLoadTimeout,onfSignUpFailure);  
      // Jalert('Check2');
       
    }
}

function onSignUpUserFirstNameSuccess(result, eventArgs)
{
    
    document.getElementById('ctl00_Header_QA_welcomeTxtSpan').innerHTML="Welcome "+result;
    var divQuickLinkID =  document.getElementById("ctl00_Header_QA_divQuickLink");
    divQuickLinkID.style.left="60px";    
   
           
}

function onSignInLoadTimeout(result)
{
    var DivLoader =  document.getElementById("divppngLogin");
    DivLoader.style.display = "block" ; 
    var spanMsg=document.getElementById("lnkppngLogin");
    spanMsg.innerHTML= "Invalid user details";
}

function onSignInFailure(result)
{
    var DivLoader =  document.getElementById("divppngLogin");
    var spanMsg=document.getElementById("lnkppngLogin");
    DivLoader.style.display = "block" ; 
    spanMsg.innerHTML= "Invalid user details";
    
}

function clickButton(e, buttonid)
{ 
      var bt = document.getElementById(buttonid);       
      if (typeof bt == 'object')
      { 
            if(navigator.appName.indexOf("Netscape")>(-1))
            { 
                  if (e.keyCode == 13)
                  { 
                        bt.click(); 
                        return false; 
                  } 
            } 
            if (navigator.appName.indexOf("Microsoft Internet Explorer")>(-1))
            { 
                  if (event.keyCode == 13)
                  { 
                        bt.click(); 
                        return false; 
                  } 
            }
        }      
} 
function validateForgetPassword()
{
    if (document.getElementById('ctl00_signUp_txtUserid').value =="")
    {
            document.getElementById('ctl00_signUp_txtUserid')
            Jalert("Enter email id") ;
            document.getElementById('ctl00_signUp_txtUserid').focus();
        return ;
    }
     var m=/^[^\s()<>@,;:\/]+@\w[\w\.-]+\.[a-z]{2,}$/i;
    if (!m.test(document.getElementById('ctl00_signUp_txtUserid').value))
   {
        Jalert("Invalid E-mail address! Please re-enter.");
        document.getElementById('ctl00_signUp_txtUserid').focus();
        return false;
   } 

     var DividCon =  document.getElementById("idCon") ;
    DividCon.style.display = "none" ; 

   var DivLoader =  document.getElementById("divFpwdLdr");
     DivLoader.style.display = "block" ; 
        
   signup.gfnForgotPwd( document.getElementById('ctl00_signUp_txtUserid').value, onfpwdSuccess, onfpwdLoadTimeout, onfpwdFailure);         
   
}

function onfpwdSuccess(result, eventArgs)
{
    var spnlblCnfrm =  document.getElementById("lblCnfrm") ;
    var DivCnfrm =  document.getElementById("cnfrm") ;
    var DividCon =  document.getElementById("idCon") ;
    DividCon.style.display = "none" ;
    DivCnfrm.style.display = "block" ;
    spnlblCnfrm.innerHTML = result ;
    var DivLoader =  document.getElementById("divFpwdLdr");
    DivLoader.style.display = "none" ; 
    //if (navigator.appName.indexOf("Microsoft Internet Explorer")>(-1))
    //{ 
        document.getElementById('FlexGallery').style.visibility="hidden";
        document.getElementById('flexCus').style.visibility="hidden";
        document.getElementById('mainDivFlex').style.visibility="hidden";
     //} 
}

function disFpwd()
{
    document.getElementById('ctl00_SignUp_txtUserid').value = "";
    var DivCnfrm =  document.getElementById("cnfrm") ;
    var DividCon =  document.getElementById("idCon") ;
    DividCon.style.display = "block" ;
    DivCnfrm.style.display = "none" ;
    document.getElementById('ctl00_SignUp_cmdSUCancel').click() ;
    
}

function onfpwdLoadTimeout(result) {

}

function onfpwdFailure(result)  {

}

/*this is for RHS signIn module  */
function validationRHSSignIn()
{
    
    if(!txtEmpty('ctl00_cph_rhsjoin_txtEmail') || document.getElementById('ctl00_cph_rhsjoin_txtEmail').value == 'Enter email id')
    {        
        Jalert("Enter your email id");
        document.getElementById('ctl00_cph_rhsjoin_txtEmail').focus();
        return false;
    }
    if(document.getElementById('ctl00_cph_rhsjoin_txtEmail').value.length >40)
    {
        Jalert("Invalid E-mail Address! Please re-enter.");
        document.getElementById('ctl00_cph_rhsjoin_txtEmail').focus();
        return false;
    }
    else
    {    
   
         if (!/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(document.getElementById('ctl00_cph_rhsjoin_txtEmail').value))
        {
            Jalert("Invalid E-mail Address! Please re-enter.");
            document.getElementById('ctl00_cph_rhsjoin_txtEmail').focus();
            return false;
        }
    }
    
    if(document.getElementById('ctl00_cph_rhsjoin_txtPassword').value.length < 1 || document.getElementById('ctl00_cph_rhsjoin_txtPassword').value == 'Enter password')
    {
        Jalert("Enter password");
        document.getElementById('ctl00_cph_rhsjoin_txtPassword').focus();        
        return false;   
    }
     signup.gfnSignIn(document.getElementById('ctl00_cph_rhsjoin_txtEmail').value,document.getElementById('ctl00_cph_rhsjoin_txtPassword').value, onRHSSignINSuccess, onRHSSignInLoadTimeout,onRHSSignInFailure);  
     return false;
}

function onRHSSignINSuccess(result, eventArgs)
{
    if (result=="-1")
    {
        var DivLoader =  document.getElementById("divppngLogin");
        DivLoader.style.display = "block" ; 
        var spanMsg=document.getElementById("lnkppngLogin");
        spanMsg.innerHTML= "Invalid user details";  
        Jalert("Invalid user details");
        document.getElementById('ctl00_cph_rhsjoin_txtEmail').focus();
        //document.getElementById("ctl00_cph_rhsjoin_divRHSCloud").style.display = "none";
        //document.getElementById("ctl00_cph_rhsjoin_divRHSSignin").style.display = "block";
         //if (navigator.appName.indexOf("Microsoft Internet Explorer")>(-1))
        //{ 
            document.getElementById('FlexGallery').style.visibility="hidden";
            document.getElementById('flexCus').style.visibility="hidden";
            document.getElementById('mainDivFlex').style.visibility="hidden";
        //} 
    }
    else
    {
        $find('modpopSignUp').hide();
        var DivLoader =  document.getElementById("divppngLogin");
        DivLoader.style.display = "none" ; 
         var DivSignUpWell =  document.getElementById("divWizardStep2a");
         DivSignUpWell.style.display = "block";   
        document.getElementById("divAccOpt").innerHTML = " <a id='lnkSignout' runat='server' href='/signout.aspx' style='border-style: none;'><img src='/images/HImages/ppng-signOut.gif' alt='Sign out' /></a>";
       // document.getElementById("ctl00_cph_rhsjoin_divRHSCloud").style.display = "block";
        //document.getElementById("ctl00_cph_rhsjoin_divRHSSignin").style.display = "none";
         //if (navigator.appName.indexOf("Microsoft Internet Explorer")>(-1))
        //{ 
            document.getElementById('FlexGallery').style.visibility="visible";
            document.getElementById('flexCus').style.visibility="visible";
            document.getElementById('mainDivFlex').style.visibility="visible";
        //} 
    }
}
function onRHSSignInLoadTimeout(result)
{
    var DivLoader =  document.getElementById("divppngLogin");
    DivLoader.style.display = "block" ; 
    var spanMsg=document.getElementById("lnkppngLogin");
    spanMsg.innerHTML= "Invalid user details";
}

function onRHSSignInFailure(result)
{
    var DivLoader =  document.getElementById("divppngLogin");
    var spanMsg=document.getElementById("lnkppngLogin");
    DivLoader.style.display = "block" ; 
    spanMsg.innerHTML= "Invalid user details";
    
}
