/**
 * @author kfrank
 * Temporary solution rewrite all js to be wrapped in EXPO Namespace
 */
Popup = 
{
	launch : function (url, type)
			{
				var winRef = (this.manager["popup_" + type]) ? this.manager["popup_" + type]: null;
				if(winRef && typeof winRef.win!= "undefined" &&  !winRef.win.closed && winRef.url == url) {
					winRef.win.focus();
					return false;
				}
				else {
					var self = this;
					var _props = Popup.getProperties(type);
					var winRef = url.toString();
					function buildPopupPropsString(_props)
					{
						var _propString = "";
						var winName = _props["name"].toString();
						for(prop in _props)
						{
							if(prop != name)
							{
								_propString += prop + "=" + _props[prop] + ","; 
							}
						}
						_propString = _propString.substring(0, _propString.length-1).toString();//remove extra comma
						var popup = window.open(url,winName,_propString);
						popup.focus();
						self.manager[winName]= {"win":popup, "url":url};
					}
					buildPopupPropsString(_props);
					return false;
				}
			}
}

Popup.getProperties = function(type)
{
	switch(type)
	{
		case "sendToFriend":
			 _props = {
				name: "popup_" + type,
				height:400,
				width:418,
				status:0,
				toolbar:0,
				scrollbars:1,
				titlebar:0,
				menubar:0,
				resizable:1,
				directories:0,
				location:0
			};
			return _props 
		break;
		
		case "videoPlayer":
			 _props = {
				name: "popup_" + type,
				height:320,
				width:328,
				status:0,
				toolbar:0,
				scrollbars:1,
				titlebar:0,
				menubar:0,
				resizable:1,
				directories:0,
				location:0
			};
			return _props 
		break;
		
		case "exitSurvey":
			 _props = {
				name: "popup_" + type,
				height:245,
				width:460,
				status:0,
				toolbar:0,
				scrollbars:1,
				titlebar:0,
				menubar:0,
				resizable:1,
				directories:0,
				location:0
			};
			return _props 
		break;
		
		default:
		return false;
	}
}

Popup.manager = new Array();