
// for polling
var refreshRate = 10000; // five seconds
var timerId;
var surveyTimeId;
var refreshRateSurvey = 10000; // five seconds

//for session no
var rnd;

var isFirstLoginRequest = false;
var time;
var gIsFlashLoaded = false;
var isHome = false;

var IE_Version="1.2";
var isExtension=false;
   
var serverPath = 'https://www.teemingpod.com/TeemingPodServer';
var path="https://www.teemingpod.com/TeemingPodServer";
var uploadImgDir ="Upload";
var ContentPathforPresenations = "https://www.teemingpod.com/ImageContents/SlideShow";
var newsStoryImagepath = "https://www.teemingpod.com/ImageContents/NewsStory";
var pathForPDF = "https://www.teemingpod.com/ImageContents/PDF";
var ChoiceImagePathforIdeation = "https://www.teemingpod.com/ImageContents/Ideation";

var adminPagePath = 'https://www.teemingpod.com/AdminTool/Web/FreeTrialDetails.aspx';
var userProfilePage = "https://www.teemingpod.com/AdminTool/Web/UpdateUserProfile.aspx";
var helpPagePath = "https://www.teemingpod.com/TeemingPod_ClientHelp.html";

var flockToStartWith = "";
var flocktivityIDToStartWith = 0;
var isLoginDone = false;
var username = "";
var orgname = "";
var password = "";
var podUID ="";
var embeInfo = "";
var typeViewAdmin = "";
var linkNoAdmin = "";

//store the file name to be loaded
var fileToBeLoaded = "Login";

//To get the source of invoke wheather it is icon or link
var sourceInvoke="";
// For Admin Summary link page. to Ge which link user has clicked.
var linkId="";
//smita ..watermaek problem
var FlockpodIconClicked=false;
// To store bypass file name/flocktivity name
var byPassFilename="";

// For Orientation
var OrientationAngle=0;
var FlockpodHeight=360;
var FlockpodWidth=600;
var resizeState=7;

// for anchor pod through code snippet
var anchorPodToPage = "";

// for storing height width of div to solve deflate issue
var Flockpod_Height=360;
var Flockpod_Width=600;

// Added by smita for deflate:Login related problem.
var sceneName="";

// added by shamaila for support statistics
var isPodClickedFromAdmin = false;

// added by smita for storing swfName to be loaded. If user selectes rectangular pod then we are loading flockpod.Rect. 
// If user selects ovel(original) shape then swfName will be flockpod.
var swfName="";

//////////// For polling ////////

// Start the update timer
function setTimers()
{
	try
	{
		timerId = window.setTimeout("fetchMessage()",refreshRate);
	}catch(e){}	
}		 

// Start to update and reset the update timer
function fetchMessage()
{
	try
	{
		getScene();
	}
	catch(e){}	
}

// reset the polling timer
function resetTimers()
{
	try
	{
		window.clearTimeout(timerId);
	}catch(e){}	
}

// calls flash file to get the scene name so that appropriate polling request can be sent
function getScene() {
	try
	{
		var obj = flashObject("FP_FlockPod");
		if(obj != undefined){
			obj.getSceneValue();
		}
	}catch(ex){
	}
}

// start the update timer
function setSurveyTimers()
{
	try
	{
		surveyTimeId = window.setTimeout( "fetchSurveyMessage()", refreshRateSurvey);
	}catch(e){}
}

// start to update and reset the update timer
function fetchSurveyMessage()
{
	try
	{
		getSurveyScene();
	}catch(e){}
}

// clears the variable and stops the polling
function resetSurveyTimers()
{
	try
	{
		window.clearTimeout( surveyTimeId );
	}catch(e){}
}

// calls flash to get the current scene value
function getSurveyScene() {
	try
	{
		var obj = flashObject("FP_FlockPod");
			if(obj != undefined){
				obj.getSceneValueToRefresh();
			} 
	}catch(ex){}
}

// returns the session no for a particular user
function getSessionNo(){
	try
	{
		return rnd;
	}catch(ex){}
}

var pollTimer=0;
// to maintain the scene from where polling takes place.
var HomeScene = "";

//for polling on common scenes
// Start the update timer
function setCommonTimers()
{
	try
	{
		pollTimer = window.setTimeout( "fetchCommonMessage()", refreshRate );
	}
	catch(e){}
}		 

// Start to update and reset the update timer
function fetchCommonMessage()
{
	HomeScene = "";
	try
	{
		resetCommonTimers();
		sendPollingPrintXML();
		//setCommonTimers();
	}
	catch(e){}	
}

// for status messages
function fetchHomeDetailsXML(sceneName)
{
	HomeScene = sceneName;
	resetSurveyTimers();
	sendPollingPrintXML();
}

function resetCommonTimers()
{
	try
	{
		window.clearTimeout( pollTimer );
	}catch(e){}	
}

// request to get status messages
function sendPollingPrintXML(){
	try
	{	
		var url = serverPath + '/messagebroadcast.aspx?action=GetStatusMessages' + '&session=' + rnd + '&sceneName=' + HomeScene +'&callback=getPollingPrintXML';
		url = url + '&UID='+ Math.random();
		var s = document.createElement("SCRIPT");
		s.src = url;
		var h = document.getElementsByTagName("head").item(0);
		h.appendChild(s);
	}catch(ex){}
}

function getPollingPrintXML(printXML)
{
	try
	{
		if(scene_global == "HomePage" || scene_global == "FlockPodSettings" || scene_global == "UserSettings" || scene_global == "ViewPrint" || scene_global == "Search" || scene_global == "WhoIsOnFlockpod") {
		// For Session Time Out
			if(sessionTimedOut(printXML))return;
			// End of For session time out
			var xmlValue = ConvertSpecialChar(printXML);
			var obj = flashObject("FP_FlockPod");
			obj.PollingPrintXML(xmlValue);
		}
	}catch(ex){}
}

/////////////// Common Code to all flocktivities /////////////////////

document.onClick=function fun()
{
	document.onkeydown = "return false";
}

// For storing themes in database
function saveThemeSettings(themeString)
{
	try
	{
		var url = serverPath + '/DynamicJS.aspx?action=SaveThemes&session=' + rnd + '&settingsValue='+themeString;
		url = url + '&UID='+ Math.random();
		var s = document.createElement("SCRIPT");
		s.src = url;
		var h = document.getElementsByTagName("head").item(0);
		h.appendChild(s);
	}
	catch(e){}
}

// when the login file is loaded send the common label xml path
function getLabelFilePath()
{
	try
	{
		return(path);
	}
	catch(e){}
}

function getSource()
{
    try
	{
		var minInfo = sourceInvoke+"*%@"+orgname;
		return minInfo;
	}
	catch(ex){	}
}

// when the login file is uploaded send the help.xml path
function getHelpFilePath(){
	try
	{
		return(helpFilePath);
	}
	catch(e){}
}

// gets session id to send in requests to server
function GetSessionID()
{
	return(rnd.toString());
}

// Passes the login information to the server
function GetUserInfo(userName, Password) {
	try{
		//if for bypass login blank username and password is given then whhen the user presses 
		//the login button again take the last organisation name and flocktivity to bypass login
		if((orgname!="" || podUID !="") && flockToStartWith!="")
		{
			isLoginDone = false;
			username = userName;
			password = Password;
			GetUserInfoEx(flockToStartWith);
		}
		else
		{
			username = userName;
			password = Password;
			// Encrypt the password
			Password = SecureContext_secure(Password);
			//Prachi ++ :: to get unique indentifier on each request of login
			rnd = Math.random();
			var url = serverPath + '/DynamicJS.aspx?action=Login&session=' + rnd + '&userName=' + encodeURIComponent(userName) + '&password=' + encodeURIComponent(Password) + 
					'&orgName='+ encodeURIComponent(orgname) +'&BubbleID=1&callback=LoginSuccess';
			url = url + '&UID='+ Math.random();

			// check the source of request
			if(checkRequestSource())
			{
				// if from enwisen
				url = url + '&IsClient=1';
			}
			else
			{
				url = url + '&IsClient=0';
			}
			
			url = url + '&IsClickedFromAdmin=' + isPodClickedFromAdmin;
			isPodClickedFromAdmin = false;
			
			var s = document.createElement("SCRIPT");
			s.src = url;
			var h = document.getElementsByTagName("head").item(0);
			h.appendChild(s);
		}
	}
	catch(e){}
}

// function to split the information recieved
function splitInfo(args) {
	try
	{
		var info = new Array(); 
		info = args.split("#:$");
		var name = info[0];
		var pwd = info[1];
		//var org = info[2];
		GetUserInfo(name,pwd);
	}
	catch(e){}
}

// Called by the flash file recieves the login information
function loginCheck(info) {
	try	{
		splitInfo(info);
	}
	catch(e){}
}

// To display the user details
function makeCall(str) {
	try{
		// For Session Time Out
		if(sessionTimedOut(str))return;
		// End of For session time out
		var obj = flashObject("FP_FlockPod");
		obj.checkLoginResponse(str,byPassFilename,themeValue, menuValue);
	}
	catch(ex){}
}

// Requests for logout
function logoutRequest(){
	try{
		var url = serverPath + '/DynamicJS.aspx?action=Logout' + '&session=' + rnd + '&callback=LogoutSuccess';
		url = url.replace(new RegExp( "\\+", "g" ), "%2B" );
		url = url + '&UID='+ Math.random();
		var s = document.createElement("SCRIPT");
		s.src = url;
		var h = document.getElementsByTagName("head").item(0);
		h.appendChild(s);	
	}
	catch(e){}
	// added for stopping polling after user has logged out
	resetSurveyTimers();
}

// Transfers the login response to the client
function makeCallLogout(args){
	try{
		// For Session Time Out
		if(sessionTimedOut(args))return;
		// End of For session time out
		var obj = flashObject("FP_FlockPod");
		eraseCookie("IsMinimised");
		obj.logoutResponse(args);
	}
	catch(ex){
	}
}

// gets info from client for forgot password request
function sendForgotPassword(emailId){
	try	{
		forgotPassword(emailId);
	}catch(e){}
}

// Sends the forgot password request with the user name
function forgotPassword(emailId){
	try
		{
			var url = serverPath + '/DynamicJS.aspx?action=ForgotPassword&EmailID='+ encodeURIComponent(emailId) + '&session=' + rnd + '&callback=ForgotPassword';
			url = url + '&UID='+ Math.random();
			var s = document.createElement("SCRIPT");
			s.src = url;
			var h = document.getElementsByTagName("head").item(0);
			h.appendChild(s);
	}catch(e){}
}

// send the request for change email or pwd
function sendUserSettings(newPwd, oldPwd, email){
	try{
		// Encrypt the new password and the old password
		newPwd = SecureContext_secure(newPwd);
		oldPwd = SecureContext_secure(oldPwd);
		var url = serverPath + '/DynamicJS.aspx?action=ChangeSettings&Password=' + encodeURIComponent(newPwd) +
								'&OldPassword=' + encodeURIComponent(oldPwd) 
								+'&EmailID='+ encodeURIComponent(email) + '&session=' + rnd+'&callback=ChangeSettings';
		url = url + '&UID='+ Math.random();
		var s = document.createElement("SCRIPT");
		s.src = url;
		var h = document.getElementsByTagName("head").item(0);
		h.appendChild(s);
		setTimers();
   }catch(e){}
}

// gets old, new pwd or email id for change settings
function getUserSettings(args){
	try{
		var info = new Array(); 
		info = args.split("*:&");
		var newPwd = info[0];
		var oldPwd = info[1];
		var email = info[2];
		sendUserSettings(newPwd, oldPwd, email);
   }catch(e){}
}

// when pwd or email is changed sends the response xml to the client
function makeCallUserSettings(args){
	try{
		// For Session Time Out
		if(sessionTimedOut(args))return;
		// End of For session time out
		var obj = flashObject("FP_FlockPod");
		if(obj != undefined){
			obj.checkUserSettings(args);
		}
	}catch(ex){	}
}

// function to change user name
function changeUserName(newName){
	try{
		var url = serverPath + '/DynamicJS.aspx?action=ChangeUserName&newUserName=' + encodeURIComponent(newName) +
				'&session=' + rnd+'&callback=ChangeSettings';
		url = url + '&UID='+ Math.random();
		var s = document.createElement("SCRIPT");
		s.src = url;
		var h = document.getElementsByTagName("head").item(0);
		h.appendChild(s);
		setTimers();
   }catch(e){}	
}

// For floating window
var isMozilla;
var objDiv = null;
var X = 0;
var Y = 0;
var DivID = "";
var over = false;
var originalDivHTML = "";
var isBubbleViewed = false;

// to show pod in div
function showBubble(scene)
{
	try
	{
		var w, h, l, t;
		w = FlockpodWidth;
		h = FlockpodHeight;
		l = screen.width/4;
		t = screen.height/4;
		if(isBubbleViewed == false)
		{
			showHomePage('bubbleContent', '', FlockpodWidth, FlockpodHeight, l, t, scene);
			isBubbleViewed = true;
		}
		else
		{
			isBubbleViewed = true;
		}
		
		// for anchor pod 
		if(anchorPodToPage == "1")
		{
			anchorPod();
		}
	}catch(e){}
}

var isLogout = false;
function logoutScene(scene){
	try
	{
		logoutRequest();
		isLogout = true;
		isHome = false;
	}catch(e){}
}

// load pod in div
function showHomePage(divId, title, width, height, left, top, scene) 
{
	try
	{	
		DivID = divId;
		document.getElementById('bubbleContent').style.visibility = "visible";
		document.getElementById(divId).style.width = width + 'px';
		document.getElementById(divId).style.height = height + 'px';
		
		if (originalDivHTML == "")
			originalDivHTML = document.getElementById(divId).innerHTML;

		var addHeader;

			addHeader = '<div id="img_holder" style="visibility:visible;"><table valign="middle" ><tr><td align="center"><img id ="bg" src = "https://www.teemingpod.com/TeemingPodServer/loader.gif"></img></td></tr></table></div>'+

		'<div id="pod_holder" style="visibility:visible"><table border="0" cellpadding="0" cellspacing="0">' +
		'<tr><td align="center" ondblclick="void(0);" style="cursor: pointer; cursor: hand;height:18px" valign="bottom"><img id="movepod" src="https://www.teemingpod.com/TeemingPodServer/movebutton.png"/>' + title + '</td>' + 

		'<tr><td style="height:"'+height+'"px, width:"'+width+'"px" align="top" valign="top">' + 
		'<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="' + width + '" height="' + height + '" id="FP_FlockPod" align= top>' +
		 
	  '<param name="movie" value="https://www.teemingpod.com/TeemingPodServer/'+swfName+'.swf">'  + 

	  '<param name="quality" value="high">' +
	  '<param name="allowScriptAccess"  value="always" />' + 
	   '<param name="allowFullScreen"  value="true" />' + 
	 '<param name="wmode"  value="transparent"/>' + 
	  '<param name="bgcolor"  value="#ffffff"  />' + 
	  '<param name="MENU"  value="false" >' + 
	  '<param name="scale"  value="noscale"  />' + 
	  '<param name="salign"  value="tl"  />' + 

	  '<param name="FlashVars" value="uploadPage=https://www.teemingpod.com/TeemingPodServer/Upload.axd">' + 
	    '<embed src="https://www.teemingpod.com/TeemingPodServer/'+swfName+'.swf" width="'+width+'" height="360" wmode="transparent"  bgcolor="#ffffff" quality="high" swLiveConnect="true" align="top" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" allowScriptAccess="always" allowFullScreen="true" scale="noscale" salign="tl" id="FP_FlockPod" name="FP_FlockPod" FlashVars="uploadPage=https://www.teemingpod.com/TeemingPodServer/Upload.axd"></embed>' + 

'</object>' +
'</td>' +
'</tr></table></div>';

		document.getElementById(divId).innerHTML = addHeader;
		document.getElementById(divId).className = 'dimming';

		document.getElementById('img_holder').style.visibility = "visible";
		document.getElementById('img_holder').style.height='1px';
		document.getElementById('img_holder').style.width='1px';

		var pos = new Position(0,0);
		var DragObj = new dragObject("bubbleContent", "movepod",pos,null,null,null,null,false);
	}
	catch(e){}
}

// for close pod functionality
function hiddenFloatingDiv(divId) 
{
	try
	{	
		document.getElementById(divId).innerHTML = originalDivHTML;
		document.getElementById(divId).style.visibility='hidden';
		document.getElementById('bubbleContent').style.visibility = 'hidden';
		isBubbleViewed = false;
		DivID = "";
	}catch(e){}
}

// for pod move
function MouseDown(e) 
{
	try{
		if (over)
		{
			if (isMozilla)
			{
				objDiv = document.getElementById(DivID);
				X = e.layerX;
				Y = e.layerY;
				return false;
			}
			else
			{
				objDiv = document.getElementById(DivID);
				objDiv = objDiv.style;
				X = event.offsetX;
				Y = event.offsetY;
			}
		}
	}
	catch(e){}		
}

// for pod move
function MouseMove(e) 
{
	try
	{
		if (objDiv) 
		{
			if (isMozilla) 
			{
				objDiv.style.top = (e.pageY-Y) + 'px';
				objDiv.style.left = (e.pageX-X) + 'px';
				return false;
			}
			else
			{
		        var flockpod_width=FlockpodWidth;
				var flockpod_height=FlockpodHeight;
					
				var w=screen.width-flockpod_width;
				var h=screen.height-flockpod_height;
				h=h-flockpod_height/2;

				var newX = event.clientX-X + document.documentElement.scrollLeft;
				if(newX>0 && newX<w){
					objDiv.pixelLeft = event.clientX-X + document.documentElement.scrollLeft;
				}
				var newY = event.clientY-Y + document.documentElement.scrollTop;
				if(newY>0 && newY<h){
					objDiv.pixelTop = event.clientY-Y + document.documentElement.scrollTop;
				}
				return false;
			}
		}
	}catch(e){}
}

// for pod move
function MouseUp() 
{
	try
	{
		objDiv = null;
	}catch(e){}
}

// load positions xml on pod load so if connection is slow controls are positioned properly
function loadTPPositionXML()
{
	try
	{
		var fileName = "https://www.teemingpod.com/TeemingPodServer";
		
		if(window.ActiveXObject)
		{
			var xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
			xmlDoc.async="false";
			xmlDoc.load(fileName + "/FlockPod_positions_Rect.xml");
			xmlObj=xmlDoc.documentElement;
		}
		else
		{
			var xmlDoc=document.implementation.createDocument("", "doc", null)
			xmlDoc.load(fileName + "/FlockPod_positions_Rect.xml"); 
		}
	}
	catch(ex)
	{
	}
}

// first function called on js load
function init()
{
	try
	{
		loadTPPositionXML();
		eraseCookie("IsMinimised");
		// load js for flash activation
		loadFlashActivationFile();
		// check browser
		// function for IE Extension versioninig.
		getVersionExt();
		isMozilla = (document.all) ? 0 : 1;
		// load the css file for extension
		loadjscssfile(path + "/floating.css", "css", "");
	}catch(e){}
}

// new code for movepod 
function hookEvent(element, eventName, callback)
{
	if(typeof(element) == "string")
		element = document.getElementById(element);
	if(element == null)
		return;
	if(element.addEventListener)
	{
		element.addEventListener(eventName, callback, false);
	}
	else if(element.attachEvent)
		element.attachEvent("on" + eventName, callback);
}

// new code for movepod 
function unhookEvent(element, eventName, callback)
{
	if(typeof(element) == "string")
		element = document.getElementById(element);
	if(element == null)
		return;
	if(element.removeEventListener)
		element.removeEventListener(eventName, callback, false);
	else if(element.detachEvent)
		element.detachEvent("on" + eventName, callback);
}

// new code for movepod 
function cancelEvent(e)
{
	e = e ? e : window.event;
	if(e.stopPropagation)
		e.stopPropagation();
	if(e.preventDefault)
		e.preventDefault();
	e.cancelBubble = true;
	e.cancel = true;
	e.returnValue = false;
	return false;
}

// new code for movepod 
function Position(x, y)
{
	this.X = x;
	this.Y = y;
  
	this.Add = function(val)
	{
		var newPos = new Position(this.X, this.Y);
		if(val != null)
		{
			if(!isNaN(val.X))
			newPos.X += val.X;
			if(!isNaN(val.Y))
			newPos.Y += val.Y
		}
		return newPos;
	}
  
	this.Subtract = function(val)
	{
		var newPos = new Position(this.X, this.Y);
		if(val != null)
		{
		if(!isNaN(val.X))
			newPos.X -= val.X;
		if(!isNaN(val.Y))
			newPos.Y -= val.Y
		}
		return newPos;
	}
  
	this.Min = function(val)
	{
		var newPos = new Position(this.X, this.Y)
		if(val == null)
			return newPos;
    
		if(!isNaN(val.X) && this.X> val.X)
			newPos.X = val.X;
		if(!isNaN(val.Y) && this.Y> val.Y)
		newPos.Y = val.Y;
    
		return newPos;  
	}
  
	this.Max = function(val)
	{
		var newPos = new Position(this.X, this.Y)
		if(val == null)
		return newPos;
    
		if(!isNaN(val.X) && this.X <val.X)
			newPos.X = val.X;
		if(!isNaN(val.Y) && this.Y <val.Y)
			newPos.Y = val.Y;
    
		return newPos;  
	}  
  
	this.Bound = function(lower, upper)
	{
		var newPos = this.Max(lower);
		return newPos.Min(upper);
	}
  
	this.Check = function()
	{
		var newPos = new Position(this.X, this.Y);
		if(isNaN(newPos.X))
			newPos.X = 0;
		if(isNaN(newPos.Y))
			newPos.Y = 0;
		return newPos;
	}
  
	this.Apply = function(element)
	{
		if(typeof(element) == "string")
			element = document.getElementById(element);
		if(element == null)
			return;
		if(!isNaN(this.X))
			element.style.left = this.X + 'px';
		if(!isNaN(this.Y))
			element.style.top = this.Y + 'px';  
	}
}

// new code for movepod 
function absoluteCursorPostion(eventObj)
{
	eventObj = eventObj ? eventObj : window.event;
  
	if(isNaN(window.scrollX))
		return new Position(eventObj.clientX + 
              document.documentElement.scrollLeft + 
              document.body.scrollLeft, 
              eventObj.clientY + 
              document.documentElement.scrollTop + 
              document.body.scrollTop);
	else
		return new Position(eventObj.clientX + window.scrollX, 
              eventObj.clientY + window.scrollY);
}

// new code for movepod 
function dragObject(element, attachElement, 
    lowerBound, upperBound, startCallback, 
    moveCallback, endCallback, attachLater)
{
	if(typeof(element) == "string")
		element = document.getElementById(element);
	
	attachElement1 = document.getElementById(attachElement);
	
	if(element == null)
		return;
  
	if(lowerBound != null && upperBound != null)
	{
		var temp = lowerBound.Min(upperBound);
		upperBound = lowerBound.Max(upperBound);
		lowerBound = temp;
	}

	var cursorStartPos = null;
	var elementStartPos = null;
	var dragging = false;
	var listening = false;
	var disposed = false;
  
	function dragStart(eventObj)
	{ 
		if(dragging || !listening || disposed) return;
			dragging = true;
    
		if(startCallback != null)
			startCallback(eventObj, element);
    
		cursorStartPos = absoluteCursorPostion(eventObj);
    
		elementStartPos = new Position(parseInt(element.style.left),
			parseInt(element.style.top));
   
		elementStartPos = elementStartPos.Check();
    
		hookEvent(document, "mousemove", dragGo);
		hookEvent(document, "mouseup", dragStopHook);
    
		return cancelEvent(eventObj);
	}
  
	function dragGo(eventObj)
	{
	    if(!dragging || disposed)
		return;
	    
	    var newPos = absoluteCursorPostion(eventObj);
		newPos = newPos.Add(elementStartPos).Subtract(cursorStartPos);
		
	    newPos = newPos.Bound(lowerBound, upperBound)
		newPos.Apply(element);
	    if(moveCallback != null)
	      moveCallback(newPos, element);
	        
	    return cancelEvent(eventObj); 
	}
  
	function dragStopHook(eventObj)
	{
	    dragStop();
	    return cancelEvent(eventObj);
	}
  
	function dragStop()
	{
	    if(!dragging || disposed) return;
	    unhookEvent(document, "mousemove", dragGo);
	    unhookEvent(document, "mouseup", dragStopHook);
	    cursorStartPos = null;
	    elementStartPos = null;
	    if(endCallback != null)
	      endCallback(element);
	    dragging = false;
	}
  
	this.Dispose = function()
	{
	    if(disposed) return;
	    this.StopListening(true);
	    element = null;
	    attachElement = null
	    lowerBound = null;
	    upperBound = null;
	    startCallback = null;
	    moveCallback = null
	    endCallback = null;
	    disposed = true;
	}
  
	this.StartListening = function()
	{
	    if(listening || disposed) return;
	    listening = true;
	    hookEvent(attachElement, "mousedown", dragStart);
	}
  
	this.StopListening = function(stopCurrentDragging)
	{
		if(!listening || disposed) return;
	    unhookEvent(attachElement, "mousedown", dragStart);
	    listening = false;
	    
	    if(stopCurrentDragging && dragging)
	      dragStop();
	}
  
	this.IsDragging = function(){ return dragging; }
	this.IsListening = function() { return listening; }
	this.IsDisposed = function() { return disposed; }
  
	if(typeof(attachElement) == "string")
		attachElement = document.getElementById(attachElement);
	if(attachElement == null)
		attachElement = element;
    
	if(!attachLater)
		this.StartListening();
}

// for teemingpod browser extension
function getVersionExt()
{
	try
	{
		if (document.all) // i.e if browser == Intenet explorer.
		{
			// Amit Agarwal, 1st December 2009 - To solve the issue where TP is not getting embeded in Blogspot.com.
			// Detailed mail has been send to niranjan regarding this issue.
			//goto: http://support.microsoft.com/kb/927917 for more info.
			var loc = document.location.toString();
			if(loc.search("blogspot.com") != -1)
			{return;}
			// --- Amit Agarwal
			var x = document.createElement('div');
			x.setAttribute('id','versionDiv');
			x.setAttribute('name','versionDiv');
			x.style.visibility='hidden';
			x.innerHTML = IE_Version;
			document.body.appendChild(x);
			
		}
	}
	catch(e){}
}

// to load the js file
function loadFlashActivationFile(){
	loadjscssfile( path + "/AC_RunActiveContent.js", "js", "AC_RunActiveContent") //dynamically load and add this .js file
}

// function to load the files dynamically
function loadjscssfile(filename, filetype, fileid){
	if (filetype=="js"){ //if filename is a external JavaScript file
		var fileref=document.createElement('script');
		fileref.setAttribute("type","text/javascript");
		fileref.setAttribute("id", fileid);
		fileref.setAttribute("src", filename);
	}
	else if (filetype=="css"){ //if filename is an external CSS file
		var fileref=document.createElement("link")
		fileref.setAttribute("rel", "stylesheet");
		fileref.setAttribute("type", "text/css");
		fileref.setAttribute("href", filename);
	}
	if (typeof fileref!="undefined"){
		document.getElementsByTagName("head")[0].appendChild(fileref);
	}
}

// calling init
init();

// For minimising the bubble
function storeCookie(args)
{
	try
	{
		var info = new Array(); 
		info = args.split(":");
		var name = info[0];
		var value = info[1];
		var days = info[2];
		sceneName=info[3];
		setCookie(name,value,days);
	}
	catch(e){}
}

// read info in cookies
function getCookie(c_name)
{
	try
	{
		if(document.cookie.length>0)
		{
			c_start=document.cookie.indexOf(c_name + "=");
			if(c_start!=-1)
			{
				c_start=c_start + c_name.length+1;
				c_end=document.cookie.indexOf(";",c_start);
				if(c_end==-1)
					c_end=document.cookie.length;
					return unescape(document.cookie.substring(c_start,c_end))
			}
		}
		return "";
	}catch(e){}
}

// set cookie
function setCookie(c_name,value,expiredays)
{
	try
	{
		var exdate=new Date();
		exdate.setDate(exdate.getDate()+expiredays);
		document.cookie=c_name+ "=" +escape(value)+
			((expiredays==null) ? "" : ";expires="+exdate.toGMTString());
	}catch(e){}
}

// erase cookie
function eraseCookie(name) 
{
	try
	{
		setCookie(name,"",-1);
	}catch(e){}
}

// decide to load pod again or make div visible
function decideView(val, scene) 
{
	if(isPodClickedFromAdmin)
	{
		showBubble(scene);
	}
	try
	{	
		var info = getCookie(val);
		if(info == "true")
		{
			showBubbleAfterMin();
		}
		else
		{
			eraseCookie(val);
			showBubble(scene);
		}
	}
	catch(e){}
}

// to show bubble in the earlier state after it has been minimised
function showBubbleAfterMin()
{
	try
	{
		decideVisibility(1);
	}catch(e){}
}

// for pdf
function createPdfSuccess()
{
	try
	{
		var obj = flashObject("FP_FlockPod");
		obj.downloadPDF(rnd.toString());
	}
	catch(e){}
}

// added by prachi to delete pdf from server once it is downloaded by the client
function deletePDF(args)
{
	var urlToDel = args;
	var url = serverPath + '/DynamicJS.aspx?action=deletePDF&session='+rnd+'&urlToDel='+encodeURIComponent(urlToDel);
	url = url + '&UID='+ Math.random();
	var encodeUrl = encodeURIComponent(url);
	var s = document.createElement("SCRIPT");
	s.src = url;
	var h = document.getElementsByTagName("head").item(0);
	h.appendChild(s);
}

// added by prachi for replacing < and > signs.
function ReplaceSpecialChar(args)
{
	try
	{
		var str = args;
		str = str.replace(/</g,'zplsthnpz');
		str = str.replace(/>/g,'zpgtthnpz');
		var obj = flashObject("FP_FlockPod");
		obj.ReplaceSpecialChar(str);
	}
	catch(e){}
}

// split save as details
function splitSaveAsDetails(args){
	try
	{
		var info = new Array(); 
		info = args.split("*:*");
		var details = unescape(info[0]);
		
		details = details.replace(/zplsthnpz/g,"&lt");
		details = details.replace(/zpgtthnpz/g,"&gt");
		var title = info[1];
		saveDialog(details, title);
	}
	catch(e){}
}

//For debbugging
function Demo(args) {
	try
	{
		document.getElementById('newOne').innerHTML=document.getElementById('newOne').innerHTML+"<BR>"+args;
	}
	catch(e){}
}

// Encyrption code 
function SecureContext_secure(strpasswd)
 {
	try
	{
		var strLength = strpasswd.length;
		var charPassword = new Array(strLength);
		var asciiValue = 0;
		charPassword = strpasswd.split("");
		charPassword = charPassword.reverse();
		strpasswd = new String;
		strpasswd = "";
		for (var i = 0; i < strLength; i++) 
		{
			var ran_number= Math.random()*26;
			ran_number = ran_number + 97;
			strpasswd = strpasswd + charPassword[i] + String.fromCharCode(ran_number);
			var ran_number= Math.random()*26;
			ran_number = ran_number + 97;
			strpasswd = strpasswd + String.fromCharCode(ran_number);
		}
		return strpasswd;    
	}catch(e){}
}

function ascii_value (c)
{
	// restrict input to a single character
	try
	{
		c = c . charAt (0);

		// loop through all possible ASCII values
		var i;
		for (i = 0; i < 256; ++ i)
		{
			// convert i into a 2-digit hex string
			var h = i . toString (16);
			if (h . length == 1)
				h = "0" + h;
			// insert a % character into the string
			h = "%" + h;
			// determine the character represented by the escape code
			h = unescape (h);
			// if the characters match, we've found the ASCII value
			if (h == c)
				break;
		}
		return i;
	}catch(e){}	
}

// set the swf position so it loads all files at same coordinates
function setFlashPosition()
{
   try
   {
		var divId = 'bubbleContent';
		var newX = 0;
		var newY = 0;
	
		if (isMozilla)
		{
			newX = X;
			newY = Y;
		}
		else
		{
			newX = event.clientX-X + document.documentElement.scrollLeft;
			newY = event.clientY-Y + document.documentElement.scrollTop;
		}
		document.getElementById(divId).style.left = newX + 'px';
		document.getElementById(divId).style.top = newY + 'px';
	}catch(e){}
}

// loads swf on click of icon
function getPageSource(UserName, Password, FlockName) {
	try
	{
		var source = document.location.search;
		if(source==""){
			var pageURL = document.location;
			splitURL = pageURL.toString();
			var urlArray = new Array();
			urlArray = splitURL.split("/");
		
			// Change urlArray[3]->urlArray[4], if the html pages are in elPodClient.
			var afterlastSlash = urlArray[4];
			var afterlastSlashArray = new Array();
			afterlastSlashArray = afterlastSlash.split(".");
			decideView('IsMinimised', 'Login');
			if(afterlastSlashArray[0] == "sample"){
				passUserDetails('guest', 'guest', 'FlockPodSample');
			}
			else if(afterlastSlashArray[0] == "community"){
				passUserDetails('guest', 'guest', 'Community');
			}
			else
			{
				passUserDetails(UserName, Password, FlockName);
			}
		}
		else
		{
			decideView('IsMinimised', 'Login');
		}
	}catch(e){}
}

// loads swf on page onload method
function getPageSourceOnLoad(){
	try
	{
		var source = document.location.search;
		//setFlashPosition();
		if(source!=""){
			var info = new Array();
			info = source.split("&");
			var user = info[0];
			var pwd = info[1];
			var org = info[2];
			var userArray = new Array();
			userArray = user.split("=");
			var pwdArray = new Array();
			pwdArray = pwd.split("=");
			var orgArray = new Array();
			orgArray = org.split("=");
			decideView('IsMinimised', 'Login');
			passUserDetails(userArray[1], pwdArray[1], orgArray[1]);
		}
	}catch(e){}
}

// For Web Developers
var gInfo = "";

function passUserDetails(user, pwd, org){
	try
	{
		var info = user + ":" + pwd + ":" + org + ":" + themeValue + ":" + menuValue;
		gInfo = info;
		sendParametersToFlash();
	}
	catch(e){}
}

function sendParametersToFlash()
{
	try
	{
		if(gIsFlashLoaded == true)
		{
			try
			{
				var obj = flashObject("FP_FlockPod");
				obj.recieveUserDetails(gInfo);
				gInfo = "";
			}
			catch(ex){}
		}
		else
		{
			setTimeout("sendParametersToFlash()", 1000);
		}
	}
	catch(ex){
	}
}

function sendUserDetails()
{
	try
	{
		gIsFlashLoaded = true;
	}
	catch(e){}	
}

function goToWebsite(){
	try
	{
		window.open('http://www.teemingpod.com');
	}
	catch(e){}
}

//to store the original x, y coordinates of the div containing the flash movie
var x;
var y;
//to store the object of the div containing the flash movie
var minObj;

//change the swf size i.e width and height
function decideVisibility(status)
{
	// if check added to solve bug 477
	if(isDeflateClicked == true)
	{
		isDeflateClicked = false;
	
		try
		{
			var browserType;
			if (document.layers) {
				browserType = "nn4";
			}
			if (document.all) {
				browserType = "ie";
			}
			if (window.navigator.userAgent.toLowerCase().match("gecko")) {
				browserType= "gecko";
			}

			if (browserType == "gecko" )
				document.poppedLayer = eval('document.getElementById("bubbleContent")');
			else if (browserType == "ie") {			
				changeheight(Flockpod_Height,Flockpod_Width);
				document.getElementById('movePod').style.visibility = "visible";
			}
			else
				document.poppedLayer = eval('document.layers["bubbleContent"]');

			if(status==1 && browserType !="ie")
			{
				document.poppedLayer.style.visibility = "visible";
				document.getElementById("pod_holder").style.visibility = "visible";
			}
			else if(status!=1 && browserType !="ie")
			{
				document.poppedLayer.style.visibility = "hidden";
			}
		}catch(e){}
	}
}

// stores the user inforamtion like name, email, image path, org which gets transfered from
// one swf to another
var userInfo;

function getUserProfile(args){
	try
	{
		if(args != "")
		{
			userInfo = args;
		}
	}
	catch(e){}
}

// sends the updated user details from one swf to another
function sendUserProfile(){
	try
	{
		var obj = flashObject("FP_FlockPod");
		if(obj !=undefined){
			obj.storeUserProfile(userInfo);
		}
	}
	catch(ex){
	}
}

// callback for login
function LoginSuccess(xml){
	try
	{
		getUsernameExt();
		setSessionTimers();
		isLoginDone = true;
		isFirstLoginRequest = true;
		makeCall(xml);
	} 
	catch(e){}
}

// callback for logout
function LogoutSuccess(newDebateXML)
{
	try
	{
		var y = document.getElementById('usernameDiv');
		y.innerHTML = "";
		resetSession();
		resetTimers();
	}catch(e){}
}

// for browser extension
function getUsernameExt()
{
	try
	{
		var y = document.getElementById('usernameDiv');
		if(y == null)
		{
			var x = document.createElement('div');
			x.setAttribute('id','usernameDiv');
			x.setAttribute('name','usernameDiv');
			x.style.visibility='hidden';
			x.innerHTML = username;
			document.body.appendChild(x);
		}
		else 
		y.innerHTML = username;
	}
	catch(e){}
}

// callback for change settings
function ChangeSettings(newDebateXML)
{
	try
	{
		makeCallUserSettings(newDebateXML);
	}
	catch(e){}	
}

function GetImagePath(ImagePath)
{
	try
	{
		makeCallUpdatedImagePath(ImagePath);
	}
	catch(e){}	
}

function ForgotPassword(newDebateXML)
{
	try
	{
		makeCallForgotPassword(newDebateXML);
	}
	catch(e){}	
}

//calls the client function to display the response
function makeCallForgotPassword(args) {
	try
	{
		// For Session Time Out
		if(sessionTimedOut(args))return;
		// End of For session time out
		var obj = flashObject("FP_FlockPod");
		obj.getForgotPassword(args);
	}
	catch(ex){
	}
}

function getFlockPodDetails(){
	try
	{
		var url = serverPath + '/DynamicJS.aspx?action=FlockPodDetails&session=' + rnd+'&callback=FlockPodDetailsResponse';
		url = url + '&UID='+ Math.random();
		var encodeUrl = encodeURIComponent(url);
		var s = document.createElement("SCRIPT");
		s.src = url;
		var h = document.getElementsByTagName("head").item(0);
		h.appendChild(s);
	}
	catch(e){}	
}

function FlockPodDetailsResponse(searchXML){
	try
	{
		// For Session Time Out
		if(sessionTimedOut(searchXML))return;
		// End of For session time out
		var obj = flashObject("FP_FlockPod");
		if(obj!=undefined){
			obj.sendFlockPodDetails(searchXML);
		}
	}
	catch(ex){
	}
}

//to return the object of a particular swf
function flashObject(loadFile)
{
	try
	{
		var isIE = navigator.appName.indexOf("Microsoft") != -1;
		var requestLocation = document.location;
		var requestStr = requestLocation.toString();
	
		// check URL for enwisen if yes then change the way flash object is extracted from doc, as in enwisen page
		// div is placed inside a form
		if(requestStr.match("enwisen.com") || requestStr.match("10.0.0.126") || requestStr.match("10.0.0.59") || requestStr.match("10.0.0.75"))
		{
			var obj= (isIE) ? window.document[loadFile] : window.document[loadFile];
		}
		else
		{
			var obj= (isIE) ? window[loadFile] : window.document[loadFile];
		}
		return obj;
	}
	catch(e){}	
}

//function called when home button is pressed and login file is loaded
function showHome()
{
	try
	{
		isHome = true;
	}
	catch(e){}	
}

function getLoginStatus(){
	try
	{
		//amit++
		try
		{
			flashLoadedForRaptivity();
		}
		catch(ex){
		}
		//amit--

		// Smita ++ Bug No.3 Now hide Loader as Pod has been loaded.
		document.getElementById('pod_holder').style.visibility = "visible";
		document.getElementById('img_holder').style.visibility = "hidden";
		// prachi++ for solving movepod bug in IE6.
		var temp = window.navigator.userAgent;
		ver = temp.substring(temp.indexOf("MSIE")+5,temp.indexOf("MSIE")+8);
		if(ver == "6.0")
		{
			try{
			document.getElementById('img_holder').innerHTML="";
			}catch(e){}
		}
	    document.getElementById('pod_holder').focus();
		//smita--
	
		try
		{
			var obj = flashObject("FP_FlockPod");
		}catch(ex){
		}
	
		// for safari only
		// var agt=navigator.userAgent.toLowerCase();
		
		// added to provide focus in flash by default
		if(document.all)
		{
			function keyDown() {
				if(isDeflateClicked == false){		
				document.FP_FlockPod.focus(); 
				}
			}
			document.onkeydown = keyDown;
		}
		else if(!document.all)
		{
			function keyDownMoz(e) 	
			{	
				
				document.FP_FlockPod.focus(); 
			}
			document.captureEvents(Event.KEYDOWN);
			document.onkeydown = keyDownMoz();
		}

		// For by pass login
		//if flocktivity to start with is home then bypass login and go to home directly
		if(flockToStartWith != "Login"){
			if(isLoginDone == false){
				GetUserInfoEx(flockToStartWith);
			}
		}
	}
	catch(e){}	
}

//function called to get the flocknames of which the logged in user is a member
function getAllFlockNames(){
	try
	{
		var url = serverPath + '/DynamicJS.aspx?action=GetFlockPodNames' + '&session=' + rnd + '&callback=flocknameResponse';
		url = url + '&UID='+ Math.random();
		var encodeUrl = encodeURIComponent(url);
		var s = document.createElement("SCRIPT");
		s.src = url;
		var h = document.getElementsByTagName("head").item(0);
		h.appendChild(s);
	}
	catch(e){}	
}

//after the request is completed gets the flockname xml form server and sends it to the client
function flocknameResponse(responseXml){
	try
	{
		// For Session Time Out
		if(sessionTimedOut(responseXml))return;
		// End of For session time out
		var obj = flashObject("FP_FlockPod");
		obj.sendFlockNames(responseXml);
	}
	catch(ex){
	}
}

//function called to split switch pods information
function splitSwitchPods(val){
	try
	{
		var info = new Array();
		info = val.split("#$@");
		var flockName = info[0];
		var subId = info[1];
		switchPods(flockName, subId , 0);
    }
	catch(e){}	
}

//sends the switch pod request to server
function switchPods(flockName, subId, switchFromSamePod){
	try
	{
		if(switchFromSamePod == 1)
		{
			if(orgname != flockName)
			{
				var url = serverPath + '/DynamicJS.aspx?action=SwitchPod&session=' + rnd +'&oldPodName=' + encodeURIComponent(orgname) + '&newPodName=' + encodeURIComponent(flockName) + '&subscriptionID=' + subId + '&callback=switchPodSuccess';
				url = url + '&UID='+ Math.random();

				var s = document.createElement("SCRIPT");
				s.src = url;
				var h = document.getElementsByTagName("head").item(0);
				h.appendChild(s);
			}
		}
		else
		{
			var url = serverPath + '/DynamicJS.aspx?action=SwitchPod&session=' + rnd +'&oldPodName=' + encodeURIComponent(orgname) + '&newPodName=' + encodeURIComponent(flockName) + '&subscriptionID=' + subId + '&callback=switchPodSuccess';
			url = url + '&UID='+ Math.random();
			
			var s = document.createElement("SCRIPT");
			s.src = url;
			var h = document.getElementsByTagName("head").item(0);
			h.appendChild(s);
		}
	}catch(e){}		
}

//when switch flockpod action is successful 
function switchPodSuccess(responseXml){
	try
	{
		// For Session Time Out
		if(sessionTimedOut(responseXml))return;
		// End of For session time out
		//parseXmlToEnableFlocktivities(responseXml);
		var obj = flashObject("FP_FlockPod");
		obj.sendNewUserDetails(responseXml);
		// Added by smita for bug no. 123. To refresh linkid for keeping track of switching pos within pod or using link.
		linkId="";
	}catch(ex){
	}
}

function getFileToLoad(){
	try
	{
		return fileToBeLoaded;
	}
	catch(e){}	
}

function getServerPath(){
	try
	{
		return path;
	}catch(e){}	
}

function getLastResizeState()
{
	try
	{	
		return resizeState;
	}
	catch(e){}	
}

function getLastAngle()
{
	try
	{
		return OrientationAngle;
	}
	catch(e){}	
}

//checks for flash version in all browsers except IE
function getFlashVersion(){
	try
	{
		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;
		// 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;
				var flashVer = versionMajor;
			}
		}
		// 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 = getFlashVersionForIE();
		}	
		//check for the version and display appropriate message
		if(parseInt(flashVer) < 8){
			alert("Upgrade to Flash Version 9. You will be redirected to Adobe Site in a few seconds.");
			window.open('http://www.adobe.com/support/flashplayer/downloads.html');
		}
	}catch(e){}	
	//smita++ as on date 01-02-2010 Full screen feature in presentation is working on flash player>8
	// So need to get flash player in presenatation flash file to handle availability of full screen button.
    return(flashVer);	
	//smita--

}

//checks the flash version for IE
function getFlashVersionForIE(){
	try
	{
		var version;
		var axo;
		var e;
		var versionArr = new Array();
		// NOTE : new ActiveXObject(strFoo) throws an exception if strFoo isn't in the registry
		// Smita++ Added as on date 03-12-09 to add check for flash player 10. too
		try {
			// version will be set for 7.X or greater players
			axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.10");
			version = axo.GetVariable("$version");
		} catch (e) {
		}//smita--
		try {
			// version will be set for 7.X or greater players
			axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.9");
			version = axo.GetVariable("$version");
		} catch (e) {
		}
		try {
			// version will be set for 7.X or greater players
			axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.8");
			version = axo.GetVariable("$version");
		} catch (e) {
		}
		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;
			}
		}

		if(version != -1){
			//find the version from the obtained string
			versionArr = version.split(" ");
			var versionNo = versionArr[1].split(",");
			return versionNo[0];
		}
		else{
			return -1;
		}
	}catch(e){}		
}

//checks whether cookies are enabled or disabled in browser and provide a appropriate message
function checkCookieSettings(){
	try
	{
		var cookieEnabled=(navigator.cookieEnabled)? true : false

		//if not IE4+ nor NS6+
		if (typeof navigator.cookieEnabled=="undefined" && !cookieEnabled){ 
			document.cookie="testcookie"
			cookieEnabled=(document.cookie.indexOf("testcookie")!=-1)? true : false
		}
		//if cookies are enabled on client's browser
		if (cookieEnabled){
			//do nothing as cookies are enabled
		}
		else{
			alert("To use certain features of TeemingPod you should enable the cookies in your browser. Follow the instructions provided at http://www.google.com/cookies.html.");
			window.open('http://www.google.com/cookies.html');
		}
   }
   catch(e){}	
}

//to split information recieved for invite request
function splitInviteParameters(args){
	try
	{
		var info = new Array();
		info = args.split("#$*");
		//store that the control has come from the pod
		var src = 1;
		//store whether pod-owner
		var ipo = true;
		//logged in user id
		var  uid = info[0];
		//subscription id
		var sid = info[1];
		//pod name
		var pn  = info[2];
		openInvitePage(src, ipo, sid,  uid, pn );
    }catch(e){}		
}

//send request for invite friends, goes to the webpage with parameters
function openInvitePage(src, ipo, sid,  uid, pn){
	try
	{
		var url = adminPagePath;
		//var url = "https://www.teemingpod.com:1632/WebSite.AdminTool/Web/InvitePodUser.aspx";
		//url = url + '?src=' + src + '&ipo=' + ipo + '&uid=' + userId + '&sid=' + subsId + '&pn=' + podName;  
		//window.open(url);
		//Added by Santosh on 10/11/2008 
		var sData;
		sData = "<body><form name='InvitePodUser' id='InvitePodUser' action='" + url + "' method='post'>";
		sData = sData + "<input type='hidden' value='" + src + "&"+ ipo + "&" + uid + "&" + sid + "&" + pn + "' id='msg' name='msg' />";
		sData = sData + "<script type='text/javascript'>";
		sData = sData + "document.InvitePodUser.submit();</sc" + "ript></form></body>";
	    OpenWindow=window.open("", "_blank");
	    OpenWindow.document.write(sData);
	    OpenWindow.document.close();
    }
	catch(e){
	}
}

// Added by shamaila 28th May 2009
function registerEmailForPod(emailState) {
	try
	{
		var url = serverPath + '/DynamicJS.aspx?action=SetEmailAlertForPod&session=' + rnd + '&callback=getResponseEmailAlerts';
		url = url + '&UID='+ Math.random() + '&emailState=' + emailState;
		var s = document.createElement("SCRIPT");
		s.src = url;
		var h = document.getElementsByTagName("head").item(0);
		h.appendChild(s);
	}
	catch(e){}
}

function getResponseEmailAlerts(response){
	//dont do anything here 
}

function getPodEmailAlertStatus() {
	try
	{
		var url = serverPath + '/DynamicJS.aspx?action=GetPodEmailAlertStatus&session=' + rnd + '&callback=getResponseEmailAlertStatus';
		url = url + '&UID='+ Math.random();
		var s = document.createElement("SCRIPT");
		s.src = url;
		var h = document.getElementsByTagName("head").item(0);
		h.appendChild(s);
	}
	catch(e){}
}

function getResponseEmailAlertStatus(response) {
	try
	{
		var obj = flashObject("FP_FlockPod");
		obj.setResponseEmailAlertStatus(response);
	}
	catch(e){}
}

function getPDFPath()
{
	return pathForPDF;
}

function getRes(){
	try
	{	
		resetSurveyTimers();
		var url = serverPath + '/FAQ.aspx?action=GetAllQuestions' + '&session=' + rnd + '&callback=Test';
		url = url + '&UID='+ Math.random();
		var s = document.createElement("SCRIPT");
		s.src = url;
		var h = document.getElementsByTagName("head").item(0);
		h.appendChild(s);
		setSurveyTimers();
	}catch(ex){}
}

function Test(args){
	try
	{
		var xmlValue = ConvertSpecialChar(args);
		var obj = flashObject("FP_Demo");
		obj.sendRes(xmlValue);
	}catch(ex){}
}

function getFlashObj(movie){
	try
	{
		if (window.document[movie]) {
			return window.document[movie];
		}
		if (navigator.appName.indexOf("Microsoft Internet")==-1)
		{
			if (document.embeds && document.embeds[movie]) 
			{
				return document.embeds[movie]; 
			}
		} 
		else
		{
			return document.getElementById(movie);
		}
	}catch(ex){}
}

//For resize 
function resetWidth(status,zoomstatus,w,h,angle) {
	try
	{
		Flockpod_Height=h;
		Flockpod_Width=w;
		var obj = getFlashObj('FP_FlockPod');
		OrientationAngle=angle;
		resizeState=status;
		if(status==7) // Default size
		{
		    if(OrientationAngle==0 || OrientationAngle==-45)
			{
				if(document.all)
				{
					document.getElementById("FP_FlockPod").style.width = w + 'px';
					document.getElementById("FP_FlockPod").style.height = h + 'px'; 
				}
				else
				{
					obj.width=w;
					obj.height=h;
				}
			}
			else if(OrientationAngle==-90)
			{
				if(document.all)
				{
					document.getElementById("FP_FlockPod").style.width = h + 'px';
					document.getElementById("FP_FlockPod").style.height = w + 'px';
				}
				else
				{
					obj.width=h;
					obj.height=w;
				}
			}
		}
		else
		{
		 	if(OrientationAngle==0 || OrientationAngle==-45)
			{
				if(document.all)
				{
					document.getElementById("FP_FlockPod").style.width = w + 'px';
					document.getElementById("FP_FlockPod").style.height = h + 'px'; 
				}
				else
				{
					obj.width=w;
					obj.height=h;
				}
			}
			else if(OrientationAngle==-90)
			{
				if(document.all)
				{
					document.getElementById("FP_FlockPod").style.width = h + 'px';
					document.getElementById("FP_FlockPod").style.height = w + 'px'; 
				}
				else
				{
					obj.width=h;
					obj.height=w;
				}
			}
	    }
		
	}catch(ex){}
	// for raptivity send the div width and height
	try{
		var info = Flockpod_Height+":"+Flockpod_Width;
		sendZoomValueForRaptivity(info);
	}catch(ex){}
}

// added by shamaila for bug 20
var isDeflateClicked = false;

function hideDiv()
{
	isDeflateClicked = true;
	
	try
	{
		try
		{
			if(document.all) // chk if browser is IE
			{
				changeheight(1,1);
				
			}
			else
			{
				document.getElementById('pod_holder').style.visibility = "hidden";
				document.getElementById('bubbleContent').style.visibility = "hidden";
			}
			document.getElementById('movePod').style.visibility = "hidden";
		}
		catch(ex){}
		try
		{
			hideWindowForRaptivity();
		}
		catch(ex){}
	}catch(ex){}
}

// added by prachi + Modifeied by Amit-9th may 2008
function changeheight(heightValue, widthValue)
{
	try
	{
		var obj = flashObject("FP_FlockPod");
		if(obj != undefined)
		{
			 if(OrientationAngle==0 || OrientationAngle==-45)
			{
				document.getElementById("FP_FlockPod").style.height = heightValue + 'px'; 
				document.getElementById("FP_FlockPod").style.width = widthValue + 'px';
			}
			else if(OrientationAngle==-90)
			{
				document.getElementById("FP_FlockPod").style.height = widthValue + 'px'; 
				document.getElementById("FP_FlockPod").style.width = heightValue + 'px';
			}
			
		}
		
	}catch(ex){}
}

// For polling after every 15 minutes so that if user doesnt perform any action the session doesnt time out if he has opened his browser ////////

var sessionTimeId;
var refreshSession = 900000; // fifteen minutes

//Start the update timer
function setSessionTimers(){
	try
	{
		sessionTimeId = window.setTimeout( "fetchSession()", refreshSession);
	}catch(ex){}
}


//Start to update and reset the update timer
function fetchSession(){
	try
	{
		resetSession();
		sendRefreshSession();
		setSessionTimers();
	}catch(ex){}
}

//Clears the variable and stops the polling
function resetSession(){
	try
	{
		window.clearTimeout(sessionTimeId);
	}catch(ex){}
}

//sends the polling request after every 15 minutes so session is alive if user hasnt performed any action but his browser is open
function sendRefreshSession(){
	try
	{
		//this mehod only sends the request so session is updates at server end
		//at client end it does nothing
		var url = serverPath + '/MessageBroadcast.aspx?action=KeepSessionAlive&session=' + rnd;
		url = url + '&UID='+ Math.random();
		var s = document.createElement("SCRIPT");
		s.src = url;
		var h = document.getElementsByTagName("head").item(0);
		h.appendChild(s);
	}catch(ex){}
}

function getImagePaths(){
	try
	{
		var obj = flashObject("FP_FlockPod");
		obj.ReceiveImagePaths(serverPath, uploadImgDir);	
	}catch(ex){}
}

//to save the soft copy on hard disk
function saveDialog(details,title)
{
	try
	{
		var browser=navigator.appName;	
		var agt=navigator.userAgent.toLowerCase();
		var pq =details;
			
			pq = pq.replace(/SIZE="12"/g,'SIZE=\"4\"');
		
		var myWindow1 = window.open('','_blank','width=1 , height=1');
	
				if(myWindow1==null)
				{
					alert("You have blocked pop-up windows. Allow pop-up windows to enable File saving.");
				}				
				else if( !myWindow1 ) 
				{
					window.alert('Sorry, could not create file.'); 
					return false;
				}
		
		if(agt.indexOf("safari") != -1)
		{
			 myWindow1.close();
			alert("Currently Save not supported in Safari");
			return false;
		}
		else if(browser == 'Netscape')	//code for Firefox and flock.
		{
			myWindow1.document.open();
			myWindow1.document.write(pq);
			ext = ".txt";
				
			/*var url ="chrome://global/content/contentAreaUtils.js" ;
			var s = document.createElement("SCRIPT");
			s.src = url;
			var h = document.getElementsByTagName("head").item(0);
			h.appendChild(s);
			*/
			try
			{
				netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
			}
			catch(e)
			{
				alert("To save this file from your browser, you need to enable browser settings. For more details, visit the help section in the pod.");
			}
			saveDocument(myWindow1.document);
			myWindow1.close();
		}
		else if(browser =='Microsoft Internet Explorer')	// code for IE
		{
			myWindow1.document.open();
			myWindow1.document.write(pq);
			var varDoc = myWindow1.document;
	
			var name=".txt";
			if( varDoc.execCommand('SaveAs', null, name))
			{
				window.alert('File has been saved.');
			}
			else
			{
				window.alert('The file has not been saved.');
			}
			myWindow1.close();
			return false;
		}
		
	}
	catch(e)
	{
	}
}

//yamini++ for print functionality
function printInJs(details){
	try
	{
		var browser=navigator.appName;	
		var agt=navigator.userAgent.toLowerCase();
		var pq =details;
		var myWindow1 = window.open('','_blank','width=1 , height=1');
		
		if(myWindow1==null)
		{
			alert("You have blocked pop-up windows. Allow pop-up windows to enable File saving.");
		}				
		else if( !myWindow1 ) 
		{
			window.alert('Sorry, could not create file.'); 
			return false;
		}
		if(agt.indexOf("safari") != -1)
		{
			pq = pq.replace(/SIZE="12"/g,'SIZE=\"4\"');
			 myWindow1.document.write(pq);
			 myWindow1.print();
			 myWindow1.close();
		}
		else if(browser == 'Netscape')	//code for Firefox and flock.
		{
			pq = pq.replace(/SIZE="12"/g,'SIZE=\"4\"');
			myWindow1.document.open();
			myWindow1.document.write(pq);
			ext = ".txt";
				
			var url ="chrome://global/content/contentAreaUtils.js" ;
			var s = document.createElement("SCRIPT");
			s.src = url;
			var h = document.getElementsByTagName("head").item(0);
			h.appendChild(s);
			
			try
			{
				netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
			}
			catch(e)
			{
				alert("To save this file from your browser, you need to enable browser settings. For more details, visit the help section in the pod.");
			}
			myWindow1.print();
			myWindow1.close();
		}
		else if(browser =='Microsoft Internet Explorer')	// code for IE
		{
			pq = pq.replace(/SIZE="12"/g,'SIZE=\"2\"');
			myWindow1.document.open();
			myWindow1.document.write(pq);
			myWindow1.document.close();
			
				myWindow1.print();
				
			myWindow1.close();
			//return false;
		}
	}
	catch(e)
	{
	}
}

// added for anchor pod  by prachi 
function getScrollingPosition()
{
	var position = [0, 0];
	if (typeof window.pageYOffset != 'undefined')
	{
		position = [window.pageXOffset,window.pageYOffset];
	}
	else if (typeof document.documentElement.scrollTop!= 'undefined' && document.documentElement.scrollTop > 0)
	{
		position = [document.documentElement.scrollLeft,document.documentElement.scrollTop];
	}
	else if (typeof document.body.scrollTop != 'undefined')
	{
		position = [document.body.scrollLeft,document.body.scrollTop];
	}
	return position;
}

// added for anchor pod  by prachi 
function removeAnchor()
{
	try
	{
		
		if(document.removeEventListener)
		{
			document.removeEventListener("click",clickPod,false);
			window.removeEventListener("scroll",scrollPod,false);
		}
		else
		{
			document.detachEvent("onclick",clickPod);
			window.detachEvent("onscroll",scrollPod);
		}
	}catch(e){}
}

// added for anchor pod  by prachi 
function anchorPod()
{
	try
	{
		if(document.addEventListener)
		{
			document.addEventListener("click",clickPod,false);
			window.addEventListener("scroll",scrollPod,false);
		}
		else
		{
			document.attachEvent("onclick",clickPod);
			window.attachEvent("onscroll",scrollPod);
			if (document.createEventObject) 
			{	
				
				var event = document.createEventObject( );
				if(document.fireEvent )
				{		
					document.fireEvent('onclick',event);	
				}
			}
		}
	}
	catch(e){
	}
}

//added by Satnosh (10/11/2008) to get current page height and widht
function getPageWidthHeight() 
{
	var myWidth = 0, myHeight = 0;
	if( typeof( window.innerWidth ) == 'number' ) {
		//Non-IE
	    myWidth = window.innerWidth;
	    myHeight = window.innerHeight;
	} else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
		//IE 6+ in 'standards compliant mode'
	    myWidth = document.documentElement.clientWidth;
	    myHeight = document.documentElement.clientHeight;
	} else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
	    //IE 4 compatible
	    myWidth = document.body.clientWidth;
	    myHeight = document.body.clientHeight;
	}
	 	  
	//To return width and height of current window.
	var position= [0,0];
	position[0] = myWidth;
	position[1] = myHeight;
	return position;
}

// added by prachi  for anchor pod  
function clickPod()
{
	orgTop = getScrollingPosition();
	var objDiv1 = document.getElementById('bubbleContent');
	orgDivX=objDiv1.offsetLeft;
	orgDivY=objDiv1.offsetTop;
	offX=orgDivX - orgTop[0];
	offY=orgDivY - orgTop[1];
	
	// Added by Santosh on 10/11/2008 to solve anchor tag bug	
	try
	{
		//Get page height and width
		var heightWidth = getPageWidthHeight();
		var pageHeight;
		var pageWidth;
		var diff;
		var bubbleLeft;
		var bubbleTop;
				
		//Get bubble height and width
		var obj = getFlashObj('FP_FlockPod');	
						
		pageHeight = heightWidth[1] + orgTop[1];
		pageWidth  = heightWidth[0] + orgTop[0];
		
		// Bubble left
		bubbleLeft = orgDivX + (obj.width/2) + 10;
			
		//Check if left of bubble is greater than current page width
		if (bubbleLeft > pageWidth)
		{
			bubbleLeft = pageWidth - ((obj.width/2) + 50);
			objDiv1.style.left=bubbleLeft+"px";	
			orgDivX=objDiv1.offsetLeft;
			offX=orgDivX - orgTop[0];
		}
			
		//Bubble top
		bubbleTop = orgDivY + 55;
		//Check if top of bubbble is greater than current page bottom 
		if (bubbleTop > pageHeight)
		{
			diff = pageHeight - 80;
			objDiv1.style.top=diff+"px";	
			orgDivY=objDiv1.offsetTop;
			offY=orgDivY - orgTop[1];
		}
					
	}
	catch(ex)
	{
	}	
};

// added by prachi for anchor pod  
function scrollPod()
{
	var scrollpos = getScrollingPosition();
	//document.title = 'left=' + scrollpos[0] + ' top=' +scrollpos[1];
	var objDiv1 = document.getElementById('bubbleContent');
	var X = scrollpos[0]+offX;
	var Y = scrollpos[1]+offY;
	objDiv1.style.left=X+"px";
	objDiv1.style.top=Y+"px";	
};

// for firefox extension
function getAllFlockNamesExt()
{
	var url = serverPath + '/DynamicJS.aspx?action=GetFlockPodNames' + '&session=' + rnd + '&callback=flocknameResponseExt';
	var encodeUrl = encodeURIComponent(url);
	var s = document.createElement("SCRIPT");
	s.src = url;
	var h = document.getElementsByTagName("head").item(0);
	h.appendChild(s);
}

// // added by prachi for extension
function flocknameResponseExt(responseXml)
{
	var xmlString=responseXml;
	if(window.ActiveXObject)
	{
			
		var xmlDoc = new ActiveXObject("Microsoft.XMLDOM");	
		xmlDoc.async="false";
		xmlDoc.loadXML(xmlString);
		xmlObject=xmlDoc.documentElement;
	}
	else
	{
		try //Firefox, Mozilla, Opera, etc.
		{
			xmlDoc=document.implementation.createDocument("","",null);
		    xmlDoc.async="false";
			parser=new DOMParser();
			xmlDoc=parser.parseFromString(xmlString,"text/xml");
			xmlObject=xmlDoc.documentElement;
		}
		catch(e){
		}	
	}

	var items = xmlObject.getElementsByTagName("Flock");
	var strname=" "; 
	for (var i = 0 ; i < items.length ; i++) 
	{
		var item = items[i];
		strname+=item.getAttribute("name"); 
		strname+='!#@';
		strname+=item.getAttribute("subsId"); 
		strname+='!#@';
	}
	if(strname == ' ')
	{
		alert("Currently, you are not a member of any pods");
		strname =' Currently, you are not a member of any pods!#@-1!#@';
		var DivElt = document.getElementById("FlockMessage");
		DivElt.innerHTML =strname;
	}
	var DivElt = document.getElementById("FlockMessage");
	DivElt.innerHTML =strname;
		
	if (document.createEventObject) 
	{	
		var event = document.createEventObject( );
		if(DivElt.fireEvent )
		{		
			DivElt.fireEvent('onclick',event);	
		
		}
	}
	else
	{	
		var doc1=document;
		var fireOnThis = doc1.getElementById('FlockMessage');
		var evObj = doc1.createEvent('MouseEvents');
		evObj.initEvent( 'click', true, true );
		fireOnThis.dispatchEvent(evObj);
	}
}

function loginExt(user,pass)
{	
	// send login request for extension
	// changes for logout 
	if(isLoginDone == true)
	{	
		var obj = flashObject("FP_FlockPod");
		obj.loadLoginOnLogout();
		hideDiv();
		eraseCookie("IsMinimised");
		
	}
	//changes for logout 
	orgname="";
	pass = SecureContext_secure(pass);
	//Prachi ++ :: to get unique indentifier on each request of login
		rnd = Math.random();
	var url = serverPath + '/DynamicJS.aspx?action=Login&session=' + rnd + '&userName=' + encodeURIComponent(user) + '&password=' + encodeURIComponent(pass) + 
				'&orgName='+ encodeURIComponent(orgname) +'&BubbleID=1&callback=LoginSuccessExt';
	url = url + '&UID='+ Math.random();
	var s = document.createElement("SCRIPT");
	s.src = url;
	var h = document.getElementsByTagName("head").item(0);
	h.appendChild(s);
}

function LoginSuccessExt(xml)
{
	try
	{
		var xmlString=xml;
		if(window.ActiveXObject)
		{
			
			var xmlDoc = new ActiveXObject("Microsoft.XMLDOM");	
			 xmlDoc.async="false";
			 xmlDoc.loadXML(xmlString);
			 xmlObject=xmlDoc.documentElement;
		}
		else
		{
			try //Firefox, Mozilla, Opera, etc.
		    {
				xmlDoc=document.implementation.createDocument("","",null);
		    	xmlDoc.async="false";
				parser=new DOMParser();
				xmlDoc=parser.parseFromString(xmlString,"text/xml");
				xmlObject=xmlDoc.documentElement;
				
			}
			catch(e){}
			
		}
		var items = xmlObject.getElementsByTagName("Results")[0].childNodes[0].nodeValue;
		if(items =="Success")
		{
			getAllFlockNamesExt();
		}
		else if(items =="Failure")
		{
			var DivElt = document.getElementById("FlockMessage");
			DivElt.innerHTML =items;
			if (document.createEventObject) 
			{	
				var event = document.createEventObject( );
				if(DivElt.fireEvent )
				{		
					DivElt.fireEvent('onclick',event);	
				}
			}
			else
			{
				var doc1=document;
				var fireOnThis = doc1.getElementById('FlockMessage');
				var evObj = doc1.createEvent('MouseEvents');
				evObj.initEvent( 'click', true, true );
				fireOnThis.dispatchEvent(evObj);
			}		
		}
	}catch(e){}
}

// Added by shamaila for opening pod with three parameters from admin tool free trial page
//Modified by archana --Date:2nd April 2009 -- To differentiate user request for pod shape
function InvokeRectangularPod(UserName, Password, FlockUID)
{
	EmbedPodCode(UserName, Password, FlockUID, 'Home', 'icon', '1', '2', '0', '7', '1', '0');
}

//added by archana for oval pod
function InvokeOvalPod(UserName, Password, FlockUID)
{
	EmbedPodCode(UserName, Password, FlockUID, 'Home', 'icon', '1', '2', '0', '7', '1', '1');
}

// For Web Developers
var themeValue = "0";
var menuValue = "0";

function EmbedPodCode(UserName, Password, FlockUID, Flocktivity, Src, linkNo, theme, orientation, size, menu, TypeOfView, anchorPod) {
	try
	{
		anchorPodToPage = anchorPod;
		
		//prachi
		if(Src == "Extension")
		{
			isExtension = true;
		}
		
		// For Web Developers
		if(theme != "")
		  themeValue = theme;
		
		if(orientation == "45")
			orientation = "-45";
		else if(orientation == "90")
			orientation = "-90";
		else
			orientation = "0";
		
		if(isDeflateClicked == false)
		{
			OrientationAngle = orientation;
		}
		
		var sizeVal = parseInt(size);
		if(TypeOfView == "1") //oval
		{
			if(sizeVal >0 && sizeVal<15)
				resizeState = size;
			else
				resizeState = 7;
		}
		else if(TypeOfView == "0") //rectangular
		{
			if(sizeVal >3 && sizeVal<13)
				resizeState = size;
			else
				resizeState = 7;
		}
		else
		{
			resizeState = 7;
		}
		
		if(menu == "0" || menu == "1")
		{
			menuValue = menu;
		}
		else
		{
			menuValue = "0";
		}
		
		// Decide type of shape for teemingpod.
		// If user has not specified any parameter for shape for teemingpod then by default show oval pod.
		if(TypeOfView==undefined)
		{
			TypeOfView = "0";
	    }
		if(TypeOfView=="0")
		{
		    swfName="Flockpod_Rect";
		}
		else if(TypeOfView=="1")
		{
			swfName="Flockpod";
		}
		else
		{
			swfName="Flockpod_Rect";
		}
		
		// for anchor pod
		
		
		// commented by Amit to solve bug id 306.
		//isLoginDone=false;
		//Added for admin summary page. To refresh the flockpod as per link
		var info = getCookie('IsMinimised');
		if(info==false)  // If FlockPod is not minimized, Refresh it.
		{
			// added by shamaila
			isLoginDone=false;
		    if(linkId==linkNo)  // same Link  Then disable
		    {
			  FlockpodIconClicked=true;
			}
			else
			{
				if(isLoginDone==true)
				logoutRequest();
				isBubbleViewed=false;
				FlockpodIconClicked=false;
				// According to the type of view decide pod size 
				if(TypeOfView=="0")
				{
				  FlockpodWidth=Flockpod_Width=480;
				  FlockpodHeight=Flockpod_Height=360;
				  orientation = "0";
				  // Commented by shamaila for resize in rectangular pod.
				 // resizeState = 7;
				}
				else if(TypeOfView=="1")
				{ 
				  FlockpodWidth=Flockpod_Width=600;
				  FlockpodHeight=Flockpod_Height=360;
				}
				else
				{
				  FlockpodWidth=Flockpod_Width=480;
				  FlockpodHeight=Flockpod_Height=360;
				  orientation = "0";
				  resizeState = 7;
				}
			}
		}
		else
		{
		    // if statement Added by smita as for icon after deflate resize state should be maintained.
		    if(Src=="icon")
		    {
		      // Added for login:Deflate related issue. 
			  if(sceneName=="LoginPage")
				 isBubbleViewed=true; 
			  // End of Added for login:Deflate related issue. 
				 
			 FlockpodIconClicked=false;
			}
			else
			{
				if(linkId!=linkNo)  // Another Link then refresh
				{
					// added by shamaila
					isLoginDone=false;
					if(isLoginDone==true)
					logoutRequest();
					isBubbleViewed=false;
					FlockpodIconClicked=false;
					
					// According to the type of view decide pod size 
					if(TypeOfView=="0")
					{
						FlockpodWidth=Flockpod_Width=480;
						FlockpodHeight=Flockpod_Height=360;
						orientation = "0";
						resizeState = 7;
					}
					else if(TypeOfView=="1")
					{ 
						FlockpodWidth=Flockpod_Width=600;
						FlockpodHeight=Flockpod_Height=360;
					}
					else
					{
						FlockpodWidth=Flockpod_Width=480;
						FlockpodHeight=Flockpod_Height=360;
						orientation = "0";
						resizeState = 7;
					}
				}
				else  // same link then disable link
				{
				    // Added for login:Deflate related issue. 
				    if(sceneName=="LoginPage")
					  isBubbleViewed=true; 
					// End of Added for login:Deflate related issue. 
					 
					FlockpodIconClicked=false;
				} 
			}
		}
		 
		linkId=linkNo;
		//End of added by smita
		
		if(FlockpodIconClicked==false)
		{	
			FlockpodIconClicked=true;	
			sourceInvoke = Src;
			flockToStartWith = Flocktivity;
			//flocktivityIDToStartWith = FlockID;

			username = UserName;
			//assign the flockname value given from the html page
			//orgname = FlockName;
			password = Password;
			podUID = FlockUID;
			//check for browser settings
			checkCookieSettings();
			getFlashVersion();

			byPassFilename =flockToStartWith;
			
			if(flockToStartWith == "Login")	{
				decideView('IsMinimised', 'Login');
				passUserDetails(username, password, orgname);
			} else if(flockToStartWith == "Home"){
				decideView('IsMinimised', 'Login');
			} else if(flockToStartWith == "SpotPoll"){
				byPassFilename = "Survey";
				decideView('IsMinimised', 'Survey');
			} else if(flockToStartWith == "TagCloud"){
				byPassFilename = "CollaborativeSearch";
				decideView('IsMinimised', 'CollaborativeSearch');
			} else if(flockToStartWith == "LinkSet" || flockToStartWith == "Bookmark"){
				byPassFilename = "ReferenceLinks";
				decideView('IsMinimised', 'ReferenceLinks');
			} else if(flockToStartWith == "Presentation"){
				byPassFilename = "Presentation";
				decideView('IsMinimised', 'SlideShow');
			//} else if(flockToStartWith == "NewsStory"){
				//byPassFilename = "NewsStory";
				//decideView('IsMinimised', 'NewsStory');
			} else if(flockToStartWith == "Debate" || flockToStartWith == "Discussion"){
				byPassFilename = "Debate";
				decideView('IsMinimised', 'Debate');
			} else if(flockToStartWith == "FAQ" || flockToStartWith == "FAQs"){
				byPassFilename = "FAQ";
				decideView('IsMinimised', 'FAQ');
			} else if(flockToStartWith == "Ideation"){
				byPassFilename = "Ideation";
				decideView('IsMinimised', 'Ideation');
			} else {
				flockToStartWith = "Login";
				byPassFilename = "Login";
				decideView('IsMinimised', 'Login');
				passUserDetails(username, password, orgname);
			}
		}
   }catch(e){
   }	
}

function passEmbedUserDetails(user, pwd, podUID){
	try
	{
		var info = user + ":" + pwd + ":" + podUID;
		embeInfo = info;
		sendParametersToFlash();
	}catch(e){}
}

function InvokePodFromAdminTool(UserName, Password, FlockName, FlockUID, linkNo, typeOfView) {
	try
	{
		orgname = FlockName;
		username = UserName;
		podUID = FlockUID;
		typeViewAdmin = typeOfView;
		linkNoAdmin = linkNo;
		//Added by Santosh on 13/11/2008 to decrypt password ( Mozila no style bug.)
		//Password = DecryptPassword(Password);
		getPasswordAdminTool(UserName);
	}catch(e){}	
}
 
// Added by shamaila 19th March 2009
function getPasswordAdminTool(UserName)
{
	try
	{
		var url = serverPath + '/DynamicJS.aspx?action=GetPasswordAdminTool&session=' + rnd + '&userName=' + encodeURIComponent(UserName) + '&callback=recievePasswordAdminTool';
		url = url + '&UID='+ Math.random();
		var s = document.createElement("SCRIPT");
		s.src = url;
		var h = document.getElementsByTagName("head").item(0);
		h.appendChild(s);
	}
	catch(e)
	{
	}
}
 
function recievePasswordAdminTool(passwordVal)
{
	passwordVal = DecryptPassword(passwordVal);
	//pod is invoked from admin tool
	isPodClickedFromAdmin = true;
	document.getElementById("bubbleContent").style.width = screen.width/2 + 'px';
	document.getElementById("bubbleContent").style.height = screen.height/2 + 'px';
		
	EmbedPodCode(username, passwordVal, podUID, 'Home', 'link', linkNoAdmin, '0', '0', '7', '1', typeViewAdmin);
}
 
 //yamini++
 //This function is used to update   session statusID to the latest value
function updateStatusID()
{
	try
	{
		var url = serverPath + '/DynamicJS.aspx?action=UpdateStatusID&session=' + rnd ;
		url = url + '&UID='+ Math.random();
		var s = document.createElement("SCRIPT");
		s.src = url;
		var h = document.getElementsByTagName("head").item(0);
		h.appendChild(s);
	}catch(e){}
}
 
//for bugID197 (flockpod 1.1)
function IncludeJS()
{
	try
	{
		var browser=navigator.appName;	
		if(browser == 'Netscape')	//code for Firefox and flock.
		{
			var url ="chrome://global/content/contentAreaUtils.js";
			var s = document.createElement("SCRIPT");
			s.src = url;
			var h = document.getElementsByTagName("head").item(0);
			var x =h.appendChild(s);
		}
	}
	catch(e){}
 }

// This function maintains the scene name where the flash client currently rresides.
var scene_global = "";
function setGlobalScene(scene)
{
	scene_global = scene;
}

///////////////////////////////// To bypass login //////////////////////////////////

function GetPageSourceEx(UserName, Password, FlockName, Flocktivity, FlockID, Src, linkNo) {
	try
	{
		EmbedPodCode(UserName, Password, FlockID, 'Login', 'Extension', '1', '2', '0', '7', '1', '1');
	}
	catch(e){}
}

function GetUserInfoEx(fileToLoad){
	try
	{
		flockToStartWith = fileToLoad;
		//amit++
		try{
			flashLoadedForRaptivity();
		}catch(ex){
		}
		//amit --

		var isEnwisenClient = "0";
		if(checkRequestSource())
		{
			isEnwisenClient = "1";
		}
	
		// Encrypt the password
		if(isLoginDone == false)
		{
			if(username != "" && password != "" && isEnwisenClient == "0")
			{
				password = SecureContext_secure(password);
				rnd = Math.random();
				var url = serverPath + '/DynamicJS.aspx?action=Login&session=' + rnd + '&userName=' + encodeURIComponent(username) + '&password=' + encodeURIComponent(password) + '&orgName='+ encodeURIComponent(orgname) +'&podUID='+ podUID +'&BubbleID=1&callback=LoginSuccessEx';
				url = url + '&UID='+ Math.random();
				url = url + '&IsClient=' + isEnwisenClient;

				url = url + '&IsClickedFromAdmin=' + isPodClickedFromAdmin;
				isPodClickedFromAdmin = false;
				var s = document.createElement("SCRIPT");
				s.src = url;
				var h = document.getElementsByTagName("head").item(0);
				h.appendChild(s);
			}
			else if(username != "" && isEnwisenClient == "1")
			{
				password = SecureContext_secure(password);
				rnd = Math.random();
				var url = serverPath + '/DynamicJS.aspx?action=Login&session=' + rnd + '&userName=' + encodeURIComponent(username) + '&password=' + encodeURIComponent(password) + '&orgName='+ encodeURIComponent(orgname) +'&podUID='+ podUID +'&BubbleID=1&callback=LoginSuccessEx';
				url = url + '&UID='+ Math.random();
				url = url + '&IsClient=' + isEnwisenClient;
				
				url = url + '&IsClickedFromAdmin=' + isPodClickedFromAdmin;
				isPodClickedFromAdmin = false;
				
				var s = document.createElement("SCRIPT");
				s.src = url;
				var h = document.getElementsByTagName("head").item(0);
				h.appendChild(s);
			}
			else
			{
				try{
					var obj = flashObject(fileToLoad);
				}catch(ex){
				}
			}
		}
		else
		{
			//can give problems due to object id change
			try{
				var obj = flashObject(fileToLoad);
			}catch(ex){
			}
			obj.loginIsAlreadyDone(userInfo);
		}
	}catch(e){}	
}

function LoginSuccessEx(xml){
	try
	{
		getUsernameExt();

		setSessionTimers();
		isLoginDone = true;
		try{
			// For Session Time Out
			if(sessionTimedOut(xml))return;
			// End of For session time out
			var obj = flashObject("FP_FlockPod");
			obj.checkLoginResponse(xml,byPassFilename,themeValue,menuValue);
		}catch(ex){	}
	}catch(e){}		
}

/////////////////////// Discussion //////////////////////////////////////////////////////////

//stores the debate title xml
var titlesXML = "";

// load the JS file for Discussion
function loadDiscussionFile()
{
	var scrptElt = document.getElementById("TP_Discussion");
	if(scrptElt == null)
	{ 
		loadjscssfile( path + "/TP_Discussion.js", "js", "TP_Discussion") //dynamically load and add this .js file
	}
}

// If the login is successful get the debate topics
function getTopicDetails(userDet){
	try
	{
		loadDiscussionFile();
		
	  	if(userDet != ""){
			userInfo = userDet;
		}

		var url = serverPath + '/Debate.aspx?action=GetDebateTopics' + '&session=' + rnd + '&callback=DebateSuccess';
		url = url + '&UID='+ Math.random();
		var s = document.createElement("SCRIPT");
		s.src = url;
		var h = document.getElementsByTagName("head").item(0);
		h.appendChild(s);
		setTimers();
	}catch(e){}	
}

function callDisplayDetails(args){
	try
	{
		titlesXML = args;
		sendTitleXML();
	}catch(e){}	
}

function sendTitleXML(){
	try
	{
		// For Session Time Out
		if(sessionTimedOut(titlesXML))return;
		// End of For session time out
		var xmlValue = ConvertSpecialChar(titlesXML);
		var obj = flashObject("FP_FlockPod");
		obj.ReceiveDebateDetails(xmlValue);
	}catch(ex){
	}
}

// Gets the debate topic who's debate details to be shown
function sendDebateDetails(args){
	try{
		var info = new Array(); 
		info = args.split("^&#");
		var instanceID = info[0];
		var IsRefresh = info[1];
		getDebateDetails(instanceID, IsRefresh);
	}catch(e){}	
}

// Requests the server to send details of a particular debate
function getDebateDetails(instanceID, IsRefresh){
	try
	{
		resetTimers();
		var url = serverPath + '/Debate.aspx?action=GetDebateDetails&InstanceID=' + instanceID+'&IsRefresh=' + IsRefresh+ '&session=' + rnd + '&callback=GetDebateDetailsXML';
		url = url + '&UID='+ Math.random();
		var s = document.createElement("SCRIPT");
		s.src = url;
		var h = document.getElementsByTagName("head").item(0);
		h.appendChild(s);
		setTimers();
	}catch(e){}	
}

function makeCallSideTitles(args){
	try
	{
		// For Session Time Out
		if(sessionTimedOut(args))return;
		// End of For session time out
		var xmlValue = ConvertSpecialChar(args);
		var obj = flashObject("FP_FlockPod");
		obj.displaySideTitles(xmlValue);
	}catch(ex){
	}
}

function DebateSuccess(newDebateString)
{
	try
	{
		if(scene_global == "DebateTitles") {
			callDisplayDetails(newDebateString);
		}
	}catch(ex){}
}

function GetDebateDetailsXML(newDebateXML)
{
	try
	{
		makeCallDebateDetails(newDebateXML);
	}catch(ex){}
}

// Calls the client function to display the deabte details
function makeCallDebateDetails(args){
	try
	{
		// For Session Time Out
		if(sessionTimedOut(args))return;
		// End of For session time out
		var xmlValue = ConvertSpecialChar(args);
		var obj = flashObject("FP_FlockPod");
		obj.displayDebateSides(xmlValue);
	}catch(ex){
	}
}

//////////////////////////////////////////////   Spot Poll     /////////////////////////////////////////////////

//stores the survey title xml
var surveyXML = "";

// load the JS file for Spot Poll
function loadSpotPollFile()
{
	var scrptElt = document.getElementById("TP_SpotPoll");
	if(scrptElt == null)
	{ 
		loadjscssfile( path + "/TP_SpotPoll.js", "js", "TP_SpotPoll") //dynamically load and add this .js file
	}
}

// function called to get the survey topics XML
function getSurveyTopics(userDet){
	try
	{
		// load JS file for poll
		loadSpotPollFile();
		
		resetSurveyTimers();
		if(userDet != "")
		{
			userInfo = userDet;
		}
		var url = serverPath + '/Survey.aspx?action=GetSurveyTopics' + '&session=' + rnd + '&callback=displaySurveyTitles';
		url = url + '&UID='+ Math.random();
		var s = document.createElement("SCRIPT");
		s.src = url;
		var h = document.getElementsByTagName("head").item(0);
		h.appendChild(s);
		setSurveyTimers();
	}catch(e){}
}

function displaySurveyTitles(newSurveyString){
	try
	{
		surveyXML = newSurveyString;
		sendSurveyTitles();
	}catch(e){}
}
-
// when getSurveyTopics request is successful this function is called
function surveySuccess(newSurveyString){
	try
	{
		if(scene_global == "SurveyTitles") {
			if(isFirstLoginRequest == true){
				isFirstLoginRequest = false;
			}
			displaySurveyTitles(newSurveyString);
		}
	}catch(e){}
}

// this function sends the survey topics xml to the client
function sendSurveyTitles(){
 	try
	{
		// For Session Time Out
		if(sessionTimedOut(surveyXML))return;
		// End of For session time out
		var xmlValue = ConvertSpecialChar(surveyXML);
		var obj = flashObject("FP_FlockPod");
		obj.recieveSurveyTitles(xmlValue);
	}catch(ex){
	}
}

// gets called when user asks for a particular survey details
function getSurveyDetails(surveyInstanceID){
	try
	{
		// check if JS file loaded for spot poll, can be a scenario for single purpose pod
		loadSpotPollFile();
		
		resetSurveyTimers();
		var url = serverPath + '/Survey.aspx?action=GetSurveyDetails&instanceID=' + surveyInstanceID + '&session=' + rnd + '&callback=getSurveyDetailsXML';
		url = url + '&UID='+ Math.random();
		var s = document.createElement("SCRIPT");
		s.src = url;
		var h = document.getElementsByTagName("head").item(0);
		h.appendChild(s);
		setSurveyTimers();
	}
	catch(e){}
}

// gets the survey details XML as response from server
function getSurveyDetailsXML(surveyXml){
	try
	{
		makeCallSurveyDetails(surveyXml);
	}catch(e){}
}

// sends the survey details XML to the client
function makeCallSurveyDetails(args){
	try
	{
		// For Session Time Out
		if(sessionTimedOut(args))return;
		// End of For session time out
		var xmlValue = ConvertSpecialChar(args);
		var obj = flashObject("FP_FlockPod");
		obj.recieveSurveyDetails(xmlValue);
	}catch(ex){
	}
}

//////////////////////////////////////////   Bookmark   //////////////////////

//to store reference title xml
var referenceXML = "";

// load the JS file for Bookmark
function loadBookmarkFile()
{
	var scrptElt = document.getElementById("TP_Bookmark");
	if(scrptElt == null)
	{ 
		loadjscssfile( path + "/TP_Bookmark.js", "js", "TP_Bookmark") //dynamically load and add this .js file
	}
}

// called to get list of of all collaborative references in flockpod
function getReferencesTitles(userDet)
{
	try
	{
		loadBookmarkFile();
		resetSurveyTimers();
		
		if(userDet != "")
		{
			userInfo = userDet;
		}
		var url = serverPath + '/CollabrativeLinks.aspx?action=GetCollaborativeReferences' + '&session=' + rnd + '&callback=listAllCollaborativeReferences';
		url = url + '&UID='+ Math.random();
		var s = document.createElement("SCRIPT");
		s.src = url;
		var h = document.getElementsByTagName("head").item(0);
		h.appendChild(s);
		setSurveyTimers();
	}catch(ex){}
}

// Method called from server to provide list of all collaborative references in a FlockPod
function listAllCollaborativeReferences(responseXML){
	try
	{
		if(isFirstLoginRequest == true){
			isFirstLoginRequest = false;
		}
		if(scene_global == "ReferenceTitles") {
			displayReferenceTitles(responseXML);
		}
		//clearTimeout(time);
	}catch(ex){}
}

function displayReferenceTitles(responseXML){
	try
	{
		referenceXML = responseXML;
		sendReferenceTitles();
    }catch(ex){}
}

//this function sends the reference links topics xml to the client
function sendReferenceTitles(){
	try
	{
		// For Session Time Out
		if(sessionTimedOut(referenceXML))return;
		// End of For session time out
		var xmlValue = ConvertSpecialChar(referenceXML);
		var obj = flashObject("FP_FlockPod");
		obj.recieveReferenceTitles(xmlValue);
	}catch(ex){
	}
}

// requests server to send details of a particular reference
function getReferenceDetails(instanceID) 
{
	try
	{
		loadBookmarkFile();
		resetSurveyTimers();
		var url = serverPath + '/CollabrativeLinks.aspx?action=GetCollaborativeRefDetails&InstanceID=' + instanceID + '&session=' + rnd + '&callback=callReferenceDetailsXML';
		url = url + '&UID='+ Math.random();
		var s = document.createElement("SCRIPT");
		s.src = url;
		var h = document.getElementsByTagName("head").item(0);
		h.appendChild(s);
		setSurveyTimers();
	}catch(ex){}
}

// Method called by server while returning XML for a specific collaborative reference
function callReferenceDetailsXML(responseXML)
{
	try
	{
		sendReferenceDetails(responseXML);
	}catch(ex){}
}

//Calls the client function to display details of a collaborative reference
function sendReferenceDetails(responseXML){
	try
	{
		// For Session Time Out
		if(sessionTimedOut(responseXML))return;
		// End of For session time out
		var xmlValue = ConvertSpecialChar(responseXML);
		var obj = flashObject("FP_FlockPod");
		obj.receiveReferenceDetails(xmlValue);
	}catch(ex){
	}
}

/////////////////////////////////// Tag Cloud //////////////////////////////////

//to store search title xml
var searchXML = "";

// load the JS file for Tag Cloud
function loadTagCloudFile()
{
	var scrptElt = document.getElementById("TP_TagCloud");
	if(scrptElt == null)
	{ 
		loadjscssfile( path + "/TP_TagCloud.js", "js", "TP_TagCloud") //dynamically load and add this .js file
	}
}

// function sends search titles when swf is loaded
function getSearchTitles(userDet)
{
	try
	{
		loadTagCloudFile();
		resetSurveyTimers();
		
		if(userDet != "")
		{
			userInfo = userDet;
		}
		var url = serverPath + '/CollaborativeSearch.aspx?action=44' + '&session=' + rnd + '&callback=listAllCollaborativeSearch';
		url = url + '&UID='+ Math.random();
		var s = document.createElement("SCRIPT");
		s.src = url;
		var h = document.getElementsByTagName("head").item(0);
		h.appendChild(s);
		setSurveyTimers();
	}catch(ex){}
}

// Method called from server to provide list of all collaborative search in a FlockPod
function listAllCollaborativeSearch(responseXML)
{
	try
	{
		if(isFirstLoginRequest == true)
		{
			isFirstLoginRequest = false;
		}
		if(scene_global == "SearchTitles") {
			displaySearchTitles(responseXML);
		}
	}catch(ex){}
}

function displaySearchTitles(responseXML)
{
	try
	{
		searchXML = responseXML;
		sendSearchTitles();
	}catch(ex){}
}

// this function sends the reference links topics xml to the client
function sendSearchTitles()
{
	try
	{
		// For Session Time Out
		if(sessionTimedOut(searchXML))return;
		// End of For session time out
		var xmlValue = ConvertSpecialChar(searchXML);
		var obj = flashObject("FP_FlockPod");
		obj.recieveSearchTitles(xmlValue);
	}catch(ex){}
}

// send the request to the server to get details about a particular category or search title
function getSearchDetails(instanceID)
{
	try
	{
		loadTagCloudFile();
		resetSurveyTimers();
		
		var url = serverPath + '/CollaborativeSearch.aspx?action=45&instanceID=' + instanceID + '&session=' + rnd + '&callback=listSearchDetails';
		url = url + '&UID='+ Math.random();
		var s = document.createElement("SCRIPT");
		s.src = url;
		var h = document.getElementsByTagName("head").item(0);
		h.appendChild(s);
		setSurveyTimers();
	}catch(ex){}
}

// gets the xml as response from server
function listSearchDetails(responseXml)
{
	try
	{
		// For Session Time Out
		if(sessionTimedOut(responseXml))return;
		// End of For session time out
		var xmlValue = ConvertSpecialChar(responseXml);
		var obj = flashObject("FP_FlockPod");
		obj.sendSearchDetails(xmlValue);
	}catch(ex){}
}

///////////////////////////////////// FAQ ////////////////////////////////////////

//to store search title xml
var quesXML = "";

// load the JS file for FAQ
function loadFAQFile()
{
	var scrptElt = document.getElementById("TP_FAQs");
	if(scrptElt == null)
	{ 
		loadjscssfile( path + "/TP_FAQs.js", "js", "TP_FAQs") //dynamically load and add this .js file
	}
}

// function called to get the questions xml
function getQuestions(userDet)
{
	try
	{
		loadFAQFile();
		resetSurveyTimers();
		
		if(userDet != ""){
			userInfo = userDet;
		}
	  	var url = serverPath + '/FAQ.aspx?action=GetAllQuestions' + '&session=' + rnd + '&callback=listAllQuestions';	
		url = url + '&UID='+ Math.random();
		var s = document.createElement("SCRIPT");
		s.src = url;
		var h = document.getElementsByTagName("head").item(0);
		h.appendChild(s);
		setSurveyTimers();
	}catch(ex){}
}

// Method called from server to provide list of all questions in a FlockPod
function listAllQuestions(responseXML)
{
	try
	{
		if(isFirstLoginRequest == true)
		{
			isFirstLoginRequest = false;
		}
		if(scene_global == "Questions") {
			displayQuestions(responseXML);
		}
	}catch(ex){}
}

function displayQuestions(responseXML)
{
	try
	{
		quesXML = responseXML;
		sendAllQuestions();
	}catch(ex){}
}

// this function sends the questions xml to the client
function sendAllQuestions()
{
	try
	{
		// For Session Time Out
		if(sessionTimedOut(quesXML))return;
		// End of For session time out
		var xmlValue = ConvertSpecialChar(quesXML);
		var obj = flashObject("FP_FlockPod");
		obj.recieveAllQuestions(xmlValue);
	}catch(ex){}
}

function getQuestionDetailsXML(questionXml)
{
	try
	{
		// For Session Time Out
		if(sessionTimedOut(questionXml))return;
		// End of For session time out
		var xmlValue = ConvertSpecialChar(questionXml);
		var obj = flashObject("FP_FlockPod");
		obj.recieveQuestionDetailsXML(xmlValue);
	}catch(ex){
	}
}

// split the question details
function splitSpecificQuestionDetails(val){
	try
	{
		var info = new Array();
		info = val.split("@#$");
		var instanceID = info[0];
		var qID = info[1];
		getSpecificQuestionDetails(qID, instanceID);
	}catch(ex){}
}

// Function to get details of a specific question.
function getSpecificQuestionDetails(qID, instanceID)
{
	try
	{
		loadFAQFile();
		resetSurveyTimers();
		
		var url = serverPath + '/FAQ.aspx?'+ '&session=' + rnd;
		var strToEncode = '&action=GetQuestionDetails&InstanceID=' + instanceID + '&QID=' + qID + '&callback=getQuestionDetailsXML';
		url = url + strToEncode;
		url = url + '&UID='+ Math.random();
		var s = document.createElement("SCRIPT");
		s.src = url;
		var h = document.getElementsByTagName("head").item(0);
		h.appendChild(s);
		setSurveyTimers();
	}catch(ex){}
}

function getPrintString(xmlValue)
{
	try
	{
		// For Session Time Out
		if(sessionTimedOut(xmlValue))return;
		// End of For session time out
		var obj = flashObject("FP_FlockPod");
		obj.recievePrint(xmlValue);
	}
	catch(ex){
	}
}

////////////////// Search Functionality /////////////////////

function sendSearchText(info){
	try
	{
		var infoArray = new Array();
		infoArray = info.split("$&*");
		var searchText = infoArray[0]; // actual word to be searched
		var activityType = infoArray[1]; //0 for "All"  or 6 for "Debate"
		var instanceId = infoArray[2]; //instance id where the search is to be performed
		var levelForComments = infoArray[3]; // Only in case of presenation comments 3 and slide comments 2, so that only that level comments are displayed
		getSearchResults(searchText, activityType,instanceId, levelForComments);
	}catch(ex){}
}


function getSearchResults(searchText, activityType,instanceId, levelForComments){
	try
	{
	
		//Added By Archana 
		//date: 18th June 2009
		//Purpose: To support backslash character(\), decode the input fields
		searchText=decodeURIComponent(searchText);

		var url = serverPath + '/SearchInsideFlockPod.aspx?action=GetSearchResults&session=' + rnd + '&SearchKeyword=' + encodeURIComponent(searchText) + '&ActivityType='+ activityType +'&InstanceID='+ instanceId + '&callback=recieveSearchResults' +'&SearchType=Keyword' + '&levelForComments=' + levelForComments;
		url = url + '&UID='+ Math.random();

		var s = document.createElement("SCRIPT");
		s.src = url;
		var h = document.getElementsByTagName("head").item(0);
		h.appendChild(s);
	}catch(ex){}
}

function recieveSearchResults(searchXML){
	try
	{
		// For Session Time Out
		if(sessionTimedOut(searchXML))return;
		// End of For session time out
		searchXML = searchXML.replace(/amppma/g, '&');
	    searchXML = searchXML.replace(/enttne/g, ' ');
	    searchXML = searchXML.replace(/%20/g, ' ');
	    searchXML = searchXML.replace(/%0D/g, '\n');
		var obj = flashObject("FP_FlockPod");
		obj.recieveSearchXML(searchXML);
	}catch(ex){	}
}

//Used to fetch the instanceXML for Spot Poll from server based on the instanceID passed by the client
//This XML is used to display the Detail search results when clicked on the specific search result o/p text
function getSpotPollXML(instanceID){
	try
	{
		var url = serverPath + '/Survey.aspx?action=GetSurveySearchContent&session=' + rnd + '&instanceID=' + instanceID +'&callback=getSurveyDetailsXML';
		url = url + '&UID='+ Math.random();
		var s = document.createElement("SCRIPT");
		s.src = url;
		var h = document.getElementsByTagName("head").item(0);
		h.appendChild(s);
	}catch(ex){}
}

//Used to fetch the instanceXML for Reference Link from server based on the instanceID passed by the client
//This XML is used to display the Detail search results when clicked on the specific search result o/p text
function getRefenceLinksXML(instanceID){
	try
	{
		var url = serverPath + '/CollabrativeLinks.aspx?action=GetReferenceLinksSearchContent&session=' + rnd + '&instanceID=' + instanceID +'&callback=callReferenceDetailsXML' ;
		url = url + '&UID='+ Math.random();
		var s = document.createElement("SCRIPT");
		s.src = url;
		var h = document.getElementsByTagName("head").item(0);
		h.appendChild(s);
	}catch(ex){}
}

//Used to fetch the instanceXM for Debate  ( Point) from server based on the instanceID passed by the client
//This XML is used to display the Detail search results when clicked on the specific search result o/p text
//function getDebateDetailPointLevelXML(instanceID, x)
function getDebateDetailPointLevelXML(instanceID){
	try
	{
		var url = serverPath + '/Debate.aspx?action=GetDebateSearchContent&session=' + rnd + '&InstanceID=' + instanceID +'&callback=makeCallDebateDetailsScene' ;
		url = url + '&UID='+ Math.random();
		var s = document.createElement("SCRIPT");
		s.src = url;
		var h = document.getElementsByTagName("head").item(0);
		h.appendChild(s);
	}catch(ex){}
}

//Used to fetch the instanceXML for Debate  ( Title,View)  from server based on the instanceID passed by the client
//This XML is used to display the Detail search results when clicked on the specific search result o/p text
function getDebateDetailXML(instanceID){
	try
	{
		var url = serverPath + '/Debate.aspx?action=GetDebateSearchContent&session=' + rnd + '&instanceID=' + instanceID +'&callback=getDebatePointsXML' ;
		url = url + '&UID='+ Math.random();
		var s = document.createElement("SCRIPT");
		s.src = url;
		var h = document.getElementsByTagName("head").item(0);
		h.appendChild(s);
	}catch(ex){}
}

function getDebatePointsXML(debateXML){
	try
	{
		// For Session Time Out
		if(sessionTimedOut(debateXML))return;
		// End of For session time out
		var xmlValue = ConvertSpecialChar(debateXML);
		var obj = flashObject("FP_FlockPod");
		obj.recieveDebatePointsXML(xmlValue);
	}catch(ex){	}
}


//Used to fetch the instanceXML for CollaborativeSearch from server based on the instanceID passed by the client
//This XML is used to display the Detail search results when clicked on the specific search result o/p text
function getCollaborativeSearchXML(instanceID){
	try
	{
		var url = serverPath + '/CollaborativeSearch.aspx?action=49&session=' + rnd + '&instanceID=' + instanceID +'&callback=refreshWords' ;
		url = url + '&UID='+ Math.random();
		var s = document.createElement("SCRIPT");
		s.src = url;
		var h = document.getElementsByTagName("head").item(0);
		h.appendChild(s);
	}catch(ex){}
}

function getFAQanswerXML(instanceID){
	try
	{
		var url = serverPath + '/FAQ.aspx?'+ '&session=' + rnd + '&action=GetFAQSearchContent&InstanceID=' + instanceID + '&callback=getQuestionDetailsXML';
		url = url + '&UID='+ Math.random();
		var s = document.createElement("SCRIPT");
		s.src = url;
		var h = document.getElementsByTagName("head").item(0);
		h.appendChild(s);
	}catch(ex){}
}

function displayAnswerDetails(searchAnswerXML){
	try
	{
		// For Session Time Out
		if(sessionTimedOut(searchAnswerXML))return;
		// End of For session time out
		var xmlValue = ConvertSpecialChar(searchAnswerXML);
		var obj = flashObject("FP_FlockPod");
		obj.displayAnswerDetailsXML(xmlValue);
	}catch(ex){}
}

//prachis ++ To convert the special characters of response from server into the user readable format 
function ConvertSpecialChar(responseXML)
{
	try
	{
	    responseXML = responseXML.replace(/amppma/g, '&');
	    responseXML = responseXML.replace(/enttne/g, '\n');
	    responseXML = responseXML.replace(/%20/g, ' ');
	    responseXML = responseXML.replace(/%0D/g, '\n');
		// Added for bug id. 178. news stroy.. To convert special character dot .
		//responseXML = responseXML.replace(/dgdotdg/g, '•');
	    return responseXML;
	}catch(ex){}
}
 
//////////////////////////////////////////////////////////// Presentation ///////////////////////////////////////////////////////////////

// load the JS file for Presentation
function loadPresentationFile()
{
	var scrptElt = document.getElementById("TP_Presentation");
	if(scrptElt == null)
	{ 
		loadjscssfile( path + "/TP_Presentation.js", "js", "TP_Presentation") //dynamically load and add this .js file
	}
}

// function to get Slide Title XML
function getSlideTitles(){
	try
	{
		loadPresentationFile();
		resetSurveyTimers();
		
		var url = serverPath + '/SlideShow.aspx?action=GetSlideShowTitles&session='+rnd+'&callback=recieveTitleXML';
		url = url + '&UID='+ Math.random();
		var s = document.createElement("SCRIPT");
		s.src = url;
		var h = document.getElementsByTagName("head").item(0);
		h.appendChild(s);
		setSurveyTimers();
	}catch(ex){}
}
 
function recieveTitleXML(xml){
	try
	{
		// For Session Time Out
		if(sessionTimedOut(xml))return;
		// End of For session time out
		if(xml != "<FlockPodUpdates><PodInfo /><StatusUpdate /></FlockPodUpdates>")
		{
			var xmlValue = ConvertSpecialChar(xml);
			var obj = flashObject("FP_FlockPod");
			obj.recieveSlideTitles(xmlValue);
		}
	}catch(ex){}
}

// function to get detail Title XML
function getSlideDetails(instanceID){
	try
	{
		loadPresentationFile();
		resetSurveyTimers();
		
	 	var url = serverPath + '/SlideShow.aspx?action=GetSlideShowDetails&session='+rnd+'&InstanceID='+instanceID+  '&callback=recieveSlideDetails';
		url = url + '&UID='+ Math.random();
		var s = document.createElement("SCRIPT");
		s.src = url;
		var h = document.getElementsByTagName("head").item(0);
		h.appendChild(s);
		setSurveyTimers(); 
	}catch(ex){}
}
 
function recieveSlideDetails(xml){
	try
	{
		// For Session Time Out
		if(sessionTimedOut(xml))return;
		// End of For session time out
		if(xml != "<FlockPodUpdates><PodInfo /><StatusUpdate /></FlockPodUpdates>")
		{
			var xmlValue = ConvertSpecialChar(xml);
			var obj = flashObject("FP_FlockPod");
			obj.recieveSlideDetails(xmlValue);
		}
	}catch(ex){}
}

// get path for uploading the presentation
function getContentPath(){
	try
	{
		return ContentPathforPresenations;
	}catch(ex){}
}

//////////////////////////////////////////////////////////////  News Story ////////////////////////////////////////////////////////////////////

// load the JS file for News Story
function loadNewsStoryFile()
{
	var scrptElt = document.getElementById("TP_NewsStory");
	if(scrptElt == null)
	{ 
		loadjscssfile( path + "/TP_NewsStory.js", "js", "TP_NewsStory") //dynamically load and add this .js file
	}
}

function receiveStoryTitles()
{
	try
	{
		loadNewsStoryFile();
		resetSurveyTimers();
		
		var url = serverPath + '/NewsStory.aspx?action=GetNewsStoryTitles&session=' + rnd + '&callback=recieveStoryTitleXML';
		url = url + '&UID='+ Math.random();
		var s = document.createElement("SCRIPT");
		s.src = url;
		var h = document.getElementsByTagName("head").item(0);
		h.appendChild(s);
		setSurveyTimers();
	}
	catch(ex){}
}

function recieveStoryTitleXML(xml)
{
	try
	{
		// For Session Time Out
		if(sessionTimedOut(xml))return;
		// End of For session time out
		if(xml != "<FlockPodUpdates><PodInfo /><StatusUpdate /></FlockPodUpdates>")
		{
			var xmlValue = ConvertSpecialChar(xml);
			var obj = flashObject("FP_FlockPod");
			obj.recieveStoryTitles(xmlValue);
		}
	}catch(ex){}
}

function receiveStoryDetails(instanceID)
{
	try
	{			
		loadNewsStoryFile();
		resetSurveyTimers();
		
		var url = serverPath + '/NewsStory.aspx?action=GetNewsStoryDetails&session=' + rnd +'&InstanceID='+instanceID +'&callback=receiveStoryDetailsXML';
		url = url + '&UID='+ Math.random();
		var s = document.createElement("SCRIPT");
		s.src = url;
		var h = document.getElementsByTagName("head").item(0);
		h.appendChild(s);
		setSurveyTimers();
	}
	catch(ex){}
}

function receiveStoryDetailsXML(xml)
{
	try
	{
		// For Session Time Out
		if(sessionTimedOut(xml))return;
		// End of For session time out
		if(xml != "<FlockPodUpdates><PodInfo /><StatusUpdate /></FlockPodUpdates>")
		{
			var xmlValue = ConvertSpecialChar(xml);
			var obj = flashObject("FP_FlockPod");
			obj.getStoryDetailsXML(xmlValue);
		}
	}catch(ex){  }
}

/////////////////////////////////////////// Ideation ///////////////////////////////////////////////////////////////// 

// load the JS file for Ideation
function loadIdeationFile()
{
	var scrptElt = document.getElementById("TP_Ideation");
	if(scrptElt == null)
	{ 
		loadjscssfile( path + "/TP_Ideation.js", "js", "TP_Ideation") //dynamically load and add this .js file
	}
}

function getIdeations(userDet){
	try
	{
		loadIdeationFile();
		resetTimers();
		
	  	if(userDet != ""){
			userInfo = userDet;
		}
		var url = serverPath + '/Ideation.aspx?action=GetIdeations' + '&session=' + rnd + '&callback=recieveIdeations';
		url = url + '&UID='+ Math.random();
		var s = document.createElement("SCRIPT");
		s.src = url;
		var h = document.getElementsByTagName("head").item(0);
		h.appendChild(s);
		setTimers();
	}catch(e){}	
}

function recieveIdeations(titlesXML){
	try
	{
		// For Session Time Out
		if(sessionTimedOut(titlesXML))return;
		// End of For session time out
		var xmlValue = ConvertSpecialChar(titlesXML);
		var obj = flashObject("FP_FlockPod");
		obj.recieveIdeations(xmlValue);
	}catch(ex){
	}
}

function GetElements(instanceID){
	try
	{
		loadIdeationFile();
		resetTimers();
		
		var url = serverPath + '/Ideation.aspx?action=GetElements&InstanceID=' + instanceID + '&session=' + rnd + '&callback=GetElementsResponse';
		url = url + '&UID='+ Math.random();
		var s = document.createElement("SCRIPT");
		s.src = url;
		var h = document.getElementsByTagName("head").item(0);
		h.appendChild(s);
		setTimers();
	}catch(e){}	
}

function GetElementsResponse(args){
	try
	{
		// For Session Time Out
		if(sessionTimedOut(args))return;
		// End of For session time out
		var xmlValue = ConvertSpecialChar(args);
		var obj = flashObject("FP_FlockPod");
		obj.displayElements(xmlValue);
	}catch(ex){
	}
}

function getideationChoices(val){
	try
	{
		var info = new Array();
		info = val.split("@#$");
		var iID = info[0];
		var EID = info[1];
		
		loadIdeationFile();
		resetTimers();
	 
		// InstanceID // elementID
		var url = serverPath + '/Ideation.aspx?action=GetChoices&InstanceID=' + iID + '&session=' + rnd + '&elementID=' + EID + '&callback=getideationChoicesResponse';
		url = url + '&UID='+ Math.random();
		var s = document.createElement("SCRIPT");
		s.src = url;
		var h = document.getElementsByTagName("head").item(0);
		h.appendChild(s);
		setTimers();
	}catch(e){}
}

function getideationChoicesResponse(choiceXML){
	try
	{
		// For Session Time Out
		if(sessionTimedOut(choiceXML))return;
		// End of For session time out
		var xmlValue = ConvertSpecialChar(choiceXML);
		var obj = flashObject("FP_FlockPod");
		obj.receiveIdeationChoicesXML(xmlValue);
	}catch(ex){
	}
}

//////////////////////////////////////////////////////////////////Session Time out Related Changes ///////////////////////////////////////////////////////////////////////////

function sessionTimedOut(retXML)
{
	if(retXML == '<Info><Result>Failure</Result><Details>Session Timed Out.</Details><Severity>1</Severity></Info>')
	{
		var obj = flashObject("FP_FlockPod");
		obj.SessionTimeOutResponse();
		return true;
	}
	return false;
}

// check that request is from enwisen
function checkRequestSource()
{
	var requestLocation = document.location;
	var requestStr = requestLocation.toString();
	
	//if(requestStr.match("enwisen.com")) // check URL for enwisen also check if pod uid is provided
	
	if(requestStr.match("enwisen.com") || requestStr.match("10.0.0.126") || requestStr.match("10.0.0.59") || requestStr.match("10.0.0.75"))
	{
		return true;
	}
	else
	{
		return false;
	}
}

//Added by Santosh on 13/11/2008 to decrypt password
function DecryptPassword(password)
{
	var strpasswd = password; 
	var strLength = strpasswd.length;
	var charPassword = new Array(strLength);
	var reversedPassword="";
	charPassword = strpasswd.split("");
 
	try
	{
		//Decrpt the password
		for (var i = strLength - 3; i >= 0; i= i- 3)
	    {
  	        reversedPassword += (charPassword[i]);
	    }
		return reversedPassword;
	}
	catch(e)
	{
		return password;
	}
}

// for request from the demo page
// to check validity of email id
function checkEmailID(emailID)
{
	try
	{
		var regexp = /[a-zA-Z0-9!#$%&'*+/=/?^_`{|}~-]+(?:\.[a-zA-Z0-9!#$%&'*+/=/?^_`{|}~-]+)*@(?:[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?\.)+[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?/;
			
		if(regexp.test(emailID))
		{
			return true;
		}
		else
		{
			return false;
		} 
	}catch(ex){}
}

// for sending request from demo to register a new user
function getRegisterUser(registerInfo)
{
	var infoArray = new Array();
	infoArray = registerInfo.split("#:&*$");
	var emailID = infoArray[0];
	var pwd = infoArray[1];
	var newsletter = infoArray[2];
	sendRegisterUser(emailID, pwd, newsletter);
}

function sendRegisterUser(emailID, pwd, newsletter)
{
	try
	{
		pwd = SecureContext_secure(pwd);
		var url = serverPath + '/DynamicJS.aspx?action=RegisterDemoUser&session=' + rnd + '&EmailID=' + encodeURIComponent(emailID) + '&Password=' + encodeURIComponent(pwd) + '&Newsletter=' + encodeURIComponent(newsletter) + '&callback=RegisterDemoUserResponse';
		url = url + '&UID='+ Math.random();
		var s = document.createElement("SCRIPT");
		s.src = url;
		var h = document.getElementsByTagName("head").item(0);
		h.appendChild(s);
	}catch(e){}
}

function RegisterDemoUserResponse(responseXML)
{
	try
	{
		var obj = flashObject("FP_Demo");
		obj.registerUserXML(responseXML);
	}catch(e){}
}

//////////////////////////////////////// To Handle Remove Image functionaltiy./////////////////////////////////////

function RemoveImage()
{
	try
	{
		var url = serverPath + '/DynamicJS.aspx?action=RemoveImage&session='+rnd+'&callback=RemoveImageResult';
		url = url + '&UID='+ Math.random();
		var s = document.createElement("SCRIPT");
		s.src = url;
		var h = document.getElementsByTagName("head").item(0);
		h.appendChild(s);
	}
	catch(e){}
}

function RemoveImageResult()
{
	try
	{
		var obj = flashObject("FP_FlockPod");
		obj.RemoveImageResult();
	}
	catch(e){}
}

///////////////////////////////////End of Remove Image functionality.///////////////////////////////////////

// Added by shamaila 
// To open the user profile page from the pod
function getUserProfileArgs(userID)
{
	var url = userProfilePage;
	var src = "1";
	var uid = userID;
	
	try
	{
		var sData;
		sData = "<body><form name='UpdateUserProfile' id='UpdateUserProfile' action='" + url + "' method='post'>";
		sData = sData + "<input type='hidden' value='" + src + "&" + uid +"' id='msg' name='msg' />";
		sData = sData + "<script type='text/javascript'>";
		sData = sData + "document.UpdateUserProfile.submit();</sc" + "ript></form></body>";
        OpenWindow=window.open("", "_blank");
        OpenWindow.document.write(sData);
        OpenWindow.document.close();
	}
	catch(ex)
	{
	}
}

function openHelpPage(pageID)
{
	var url = helpPagePath + "#"+pageID;
	window.open(url);
}

///////////////////////////////////////// Webinar Activity ///////////////

function InvokePod(UserName,Password, FlockUID, Flocktivity, theme, orientation, size,  TypeOfView ) {
	try
	{ 
		username = UserName;
		podUID = FlockUID;
		typeViewAdmin = TypeOfView ;
		activityName=Flocktivity;
		podTheme=theme;
		podOrientation=orientation;
		podSize=size;
		//getPassword(UserName);
		UserName=DecryptPassword(UserName);
		Password = DecryptPassword(Password);
		
		EmbedPodCode(UserName, Password, podUID, activityName, 'link', 1, podTheme, podOrientation, podSize, '1', typeViewAdmin);
	}catch(e){}	
}

function CreateAndActivateUser(FirstName, LastName, Company, PhoneNo, EmailID,WebinarInfo,WebinarURL,WebinarMailID)
{
	try
	{
		var url = serverPath + '/DynamicJS.aspx?action=CreatedUserAccountAndActivate&session=' + rnd + '&FirstName=' + encodeURIComponent(FirstName) + '&LastName=' + encodeURIComponent(LastName) + '&Company=' + encodeURIComponent(Company) + '&PhoneNo=' + encodeURIComponent(PhoneNo) + '&EmailID=' + encodeURIComponent(EmailID) + '&WebinarInfo=' + encodeURIComponent(WebinarInfo) + '&WebinarURL=' + encodeURIComponent(WebinarURL) + '&WebinarMailID=' + encodeURIComponent(WebinarMailID) + '&callback=receiveActivateUser';
		url = url + '&UID='+ Math.random();
		var s = document.createElement("SCRIPT");
		s.src = url;
		var h = document.getElementsByTagName("head").item(0);
		h.appendChild(s);
	}
	catch(e)
	{
	}
}

function receiveActivateUser(responseXML)
{
	SubmitResponse(responseXML);
}

function CheckValidUser(username,password)
{
	rnd = Math.random();
	var url = serverPath + '/DynamicJS.aspx?action=VerifyTeemingPodUser&session=' + rnd + '&userName=' + encodeURIComponent(username) + '&password=' + encodeURIComponent(password) + '&callback=ValidUserResponse';
	var s = document.createElement("SCRIPT");
	s.src = url;
	var h = document.getElementsByTagName("head").item(0);
	h.appendChild(s);
}

function ValidUserResponse(responseXML)
{
	GetUserValidity(responseXML);
}



//ADDED BY AMIT SHAH
// get scene value from client for polling request
function splitSceneValue(args)
{
	try
	{
		var info = new Array();
		info = args.split("@#$");
		var sceneVal = info[0];
		var instanceID = info[1];
		sendSceneValue(sceneVal, instanceID);
	}catch(e){}	
}

// send polling request to server
function sendSceneValue(sceneVal, instanceID)
{
	try
	{
		if (sceneVal == "DebateTitles")
		{	resetTimers();
			var url = serverPath + '/messagebroadcast.aspx?action=' +sceneVal + '&session=' + rnd + '&callback=DebateTitles';
			url = url + '&UID='+ Math.random();
			var s = document.createElement("SCRIPT");
			s.src = url;
			var h = document.getElementsByTagName("head").item(0);
			h.appendChild(s);
			setTimers();
		}
		else if(sceneVal == "DebateDetails" || sceneVal == "Select Sides")
		{	resetTimers();
			var url = serverPath + '/messagebroadcast.aspx?action='+ sceneVal +'&InstanceID='+ instanceID + '&session=' + rnd + '&callback=DebateDetails';
			url = url + '&UID='+ Math.random();
			var s = document.createElement("SCRIPT");
			s.src = url;
			var h = document.getElementsByTagName("head").item(0);
			h.appendChild(s);
			setTimers();
		}
	}catch(e){}	
}

// call back for polling on title scene
function DebateTitles(newDebateXML)
{
	try
	{
		if(scene_global == "DebateTitles") {
			if(newDebateXML != "<FlockPodUpdates><PodInfo /><StatusUpdate /></FlockPodUpdates>")
			{
				makeCallDebateTitleSummary(newDebateXML);
			}
		}
	}catch(ex){}
}

// sends polling xml for title scene to client
function makeCallDebateTitleSummary(summaryXml){
	try
	{
		// For Session Time Out
		if(sessionTimedOut(summaryXml))return;
		// End of For session time out
		var xmlValue = ConvertSpecialChar(summaryXml);
		var obj = flashObject("FP_FlockPod");
		obj.getDebateTitleSummary(xmlValue);
	}catch(ex){
	}
}

// callback for polling on views and points scene
function DebateDetails(newDebateXML, SceneVal)
{
	try
	{
		if(newDebateXML != "<FlockPodUpdates><PodInfo /><StatusUpdate /></FlockPodUpdates>")
		{
			if (SceneVal == "DebateDetails")
			{
				makeCallDebateDetailSummary(newDebateXML);
			}
			else 
			{
				makeCallDebateSideSummary(newDebateXML);
			}
		}
	}catch(ex){}
}

// sends polling xml for point scene to client
function makeCallDebateDetailSummary(summaryXml){
	try
	{
		// For Session Time Out
		if(sessionTimedOut(summaryXml))return;
		// End of For session time out
		var xmlValue = ConvertSpecialChar(summaryXml);
		var obj = flashObject("FP_FlockPod");
		obj.getDebateDetailsSummary(xmlValue);
	}catch(ex){
	}
}

// sends polling xml for view scene to client
function makeCallDebateSideSummary(summaryXml){
	try
	{
		// For Session Time Out
		if(sessionTimedOut(summaryXml))return;
		// End of For session time out
		var xmlValue = ConvertSpecialChar(summaryXml);
		var obj = flashObject("FP_FlockPod");
		obj.getDebateSidesSummary(xmlValue);
	}catch(ex){
	}
}
