
/**
 * @author Samsung
 */

function View(id) {
 		this.viewObj=id; /*= document.getElementById(id);*/

	this.currentHighlight = null;
	this.currentSelected = null;
	// this.currentHighlight= new Item();
	this.anchor = null;

	this.flag_ShowState = false;
	this.flag_Focus = false;

	this.popup = null;
	this.helpBar = null;

	this.onClickCallbackFunc = null;
	this.flagClickEnable = false;
}

View.prototype.show = function() {

	this.flag_ShowState = this;
     if(this.helpBar)
     {
		this.helpBar.visibleObj();
	}
}


View.prototype.hide = function() {
	this.viewObj.style.display = "none";
	this.flag_ShowState = false;

      if(this.helpBar)
     {
		this.helpBar.hiddenObj();
	}
}
View.prototype.GetObjId = function (){
	return this.viewObj;
}
View.prototype.setAnchor = function(id) {

	this.anchor = document.getElementById(id);

}

View.prototype.SetBgImage = function(bgImage) {
	//this.viewObj.style.backgroundImage ="url("+bgImage+")";
	$("#" + this.viewObj).css('background-image', 'url(' + bgImage + ')');
}

View.prototype.setCurrenHighlight = function(obj) {
	alert("setCurrenHighlight()");
	// if(this.currentHighlight){
	// alert("setCurrenHighlight() : currentHighlight-->"+this.currentHighlight.GetText());
	// }

    if( this.currentHighlight !=obj && this.currentHighlight !=null)
    {
		this.currentHighlight.blur();
	}
	this.currentHighlight = obj;

    if(this.currentHighlight)
    {
		this.currentHighlight.highlight();
	}

}

View.prototype.setCurrenHighlightObj = function(obj) {

	this.currentHighlight = obj;
}


View.prototype.getCurrentHighlight = function() {

	return this.currentHighlight;
}

View.prototype.setCurrentSelect = function(obj) {
    if(obj == this.currentHighlight)
    {
		this.currentHighlight.select();
		this.currentSelected = obj;
	}
}

View.prototype.getCurrentSelected = function() {

	return this.currentSelected;
}

View.prototype.focus = function() {
	alert("##### View.prototype.focus");
	this.anchor.focus();
	this.flag_Focus = true;
}

View.prototype.blur = function() {
	alert("##### View.prototype.blur");
	this.anchor.blur();
	this.flag_Focus = false;
}

View.prototype.flagFocus = function() {
	return this.flag_Focus;
}

View.prototype.showState = function() {
	return this.flag_ShowState;
}

View.prototype._onfocus = function() {

	alert("##### View.prototype._onfocus");
}

View.prototype._onblur = function() {

	alert("##### View.prototype._onblur");
}

View.prototype.registHelpBar = function(obj) {
    if(obj)
    {
		this.helpBar = obj;
		this.helpBar.visibleObj();
	}

}

View.prototype.changeHelpBar = function(obj) {

    if(this.helpBar == obj)
    {
		return;
	}

    if(this.helpBar != null)
    {
		this.helpBar.hiddenObj();
	}

     if(obj)
    {
		this.helpBar = obj;
		this.helpBar.visibleObj();
	}
}

View.prototype.visibleObj=function()
{
	//alert("Button.prototype.visibleObj()");
	$("#" + this.viewObj).css("visibility", "visible");

}

View.prototype.hiddenObj = function() {
	//alert("Button.prototype.hiddenObj()");
	$("#" + this.viewObj).css("visibility", "hidden");
}

//2013 add by minseok
View.prototype.ChangeClass = function(_top, _left, _width, _height){
	alert("View.ChangeSize!! : "+_top+", "+_left+", "+_width+", "+_height);
	if(_top >= 0){
		$("#" + this.viewObj).css('top',_top+'px');
	}
	if(_left >= 0){
		$("#" + this.viewObj).css('left',_left+'px');
	}
	if(_width >= 0){
		$("#" + this.viewObj).css('width',_width+'px');
	}
	if(_height >= 0){
		$("#" + this.viewObj).css('height',_height+'px');
	}
}

View.prototype.SetOnClickCallbackFunc = function(func)
{
	if(WndMgr.MouseClickEnable==false)
	{
		return;
	}
	alert("View.SetOnClickCallbackFunc() set on image_layer");

	this.onClickCallbackFunc = func;
	//this.EnableOnClick();
}

View.prototype.EnableOnClick = function()
{
	if(WndMgr.MouseClickEnable==false)
	{
		return;
	}

	if(this.flagClickEnable == false)
	{
		var object = this.viewObj;
		var this_ = this;
		document.getElementById(object).onclick = function(){this_.onClickCallbackFunc(this_);};
		this.flagClickEnable = true;
		//$("#"+this.image_layer.GetObjectId()).css({'cursor' : 'pointer'});
	}
}

View.prototype.DisableOnClick = function()
{
	if(WndMgr.MouseClickEnable==false)
	{
		return;
	}

	if(this.flagClickEnable == true)
	{
		var object = this.viewObj;
		document.getElementById(object).onclick = null;
		this.flagClickEnable = false;
		//$("#"+this.image_layer.GetObjectId()).css({'cursor' : ''});
	}
}

////////////////////////////////////////Action popup/////////////////////////////////////////////////

View.prototype.CreatePopupBG = function(type,style)
{
	alert("View.CreatePopupBG");
	var htmlStr = '<div id="' + this.viewObj + '_popup"></div>';
	$("#" + this.viewObj).append(htmlStr);
	$("#" + this.viewObj + '_popup').addClass(style);
	//for remove 'px' string
	var left_ = parseInt($("#" + this.viewObj + '_popup').css('left').replace(/[^-\d\.]/g, '')) + 1;
	var top_ = parseInt($("#" + this.viewObj + '_popup').css('top').replace(/[^-\d\.]/g, '')) + 1;
	var width_ = parseInt($("#" + this.viewObj + '_popup').css('width').replace(/[^-\d\.]/g, '')) + 1;
	var height_ = parseInt($("#" + this.viewObj + '_popup').css('height').replace(/[^-\d\.]/g, '')) + 1;
	var z_index = $("#"+this.viewObj+'_popup').css('z-index');
	alert("z-index : "+z_index);
	// alert("left : "+left_);
	// alert("top : "+top_);
	// alert("width : "+width_);
	// alert("height : "+height_);

	this.popup = new Popup_View(this.viewObj + '_popup', type);
	this.popup.Create(left_,top_,width_,height_,z_index);

}

View.prototype.CreateCoorPopupBG = function(type,left_,top_,width_,height_,z_index_)
{
	//alert("View.CreatePopupBG");
	var htmlStr = '<div id="'+this.viewObj+'_popup"></div>';
	$("#"+this.viewObj).append(htmlStr);
	
	this.popup = new Popup_View(this.viewObj+'_popup',type);
	this.popup.Create(left_,top_,width_,height_,z_index_);
	
}

View.prototype.RemovePopupBG = function() {
	if(this.popup) {
		alert("RemovePopupBG() : remove DOM->" + this.viewObj + '_popup');
		$("#" + this.viewObj + '_popup').remove();
	}
}

View.prototype.ChangePopupBGSize = function(style,l,t,w,h)
{
	//Please check exception (div _popup)
	if(style){
		$("#"+this.viewObj+'_popup').removeClass();
		$("#" + this.viewObj + '_popup').addClass(style);
	
		var htmlStr = '<div id="tempDiv"></div>';
		$("#"+this.viewObj).append(htmlStr);
		$("#tempDiv").addClass(style);
		
		// var left_ = parseInt($("#"+this.viewObj+'_popup').css('left').replace(/[^-\d\.]/g, ''))+1;
		// var top_ = parseInt($("#"+this.viewObj+'_popup').css('top').replace(/[^-\d\.]/g, ''))+1;
		// var width_ = parseInt($("#"+this.viewObj+'_popup').css('width').replace(/[^-\d\.]/g, ''))+1;
		// var height_ = parseInt($("#"+this.viewObj+'_popup').css('height').replace(/[^-\d\.]/g, ''))+1;	
		this.l = parseInt($("#tempDiv").css('left').replace(/[^-\d\.]/g, ''))+1;
		this.t = parseInt($("#tempDiv").css('top').replace(/[^-\d\.]/g, ''))+1;
		this.w= parseInt($("#tempDiv").css('width').replace(/[^-\d\.]/g, ''))+1;
		this.h = parseInt($("#tempDiv").css('height').replace(/[^-\d\.]/g, ''))+1;	
		$("#tempDiv").remove();
	}
	if(l)this.l = l;
	if(t)this.t = t;
	if(w)this.w = w;
	if(h)this.h = h;	
	this.popup.ChangeBGSize(this.l,this.t,this.w,this.h);
}
View.prototype.ChangeInnerBox = function(l,t,w,h) 
{
	this.popup.SetInnerboxStyle(l,t,w,h);
}
View.prototype.CreateInnerBox = function(style) {
	if(this.popup) {
		var htmlStr = '<div id="tempDiv"></div>';
		$("#" + this.viewObj).append(htmlStr);
		$("#tempDiv").addClass(style);
		var left = parseInt($("#tempDiv").css('left').replace(/[^-\d\.]/g, '')) + 1;
		var top= parseInt($("#tempDiv").css('top').replace(/[^-\d\.]/g, '')) + 1;
		var width = parseInt($("#tempDiv").css('width').replace(/[^-\d\.]/g, '')) + 1;
		var height = parseInt($("#tempDiv").css('height').replace(/[^-\d\.]/g, '')) + 1;
		alert("createinnerbox width : " + width);
		alert("createinnerbox height : " + height);

		$("#tempDiv").remove();
		this.popup.CreateInnerBox();
		this.popup.SetInnerboxStyle(left, top, width, height);
	}
}
View.prototype.SetTitleTextofPopupBG = function(title_text)
{
	this.popup.CreateTitle();
	this.popup.SetTitleText(title_text);

}

View.prototype.SetHelpbarContentsOfPopupBG = function(HelpData){
	this.popup.ChangeHelpbar(HelpData);
}

////////////////////////Loading popup///////////////////////////////
View.prototype.SetLoadingPopupBG = function(url) {
	this.popup.SetLoadingBG(url);
}
View.prototype.CreateLoadingPopup = function(style) {
	var htmlStr = '<div id="tempDiv"></div>';
	$("#" + this.viewObj).append(htmlStr);
	$("#tempDiv").addClass(style);
	var left = parseInt($("#tempDiv").css('left').replace(/[^-\d\.]/g, '')) + 1;
	var top = parseInt($("#tempDiv").css('top').replace(/[^-\d\.]/g, '')) + 1;
	$("#tempDiv").remove();
	this.popup.CreateLoading(left, top);
}
View.prototype.CreateLoadingPopupText = function(style) {
	var htmlStr = '<div id="tempDiv"></div>';
	$("#" + this.viewObj).append(htmlStr);
	$("#tempDiv").addClass(style);
	var left = parseInt($("#tempDiv").css('left').replace(/[^-\d\.]/g, '')) + 1;
	var top = parseInt($("#tempDiv").css('top').replace(/[^-\d\.]/g, '')) + 1;
	var width = parseInt($("#tempDiv").css('width').replace(/[^-\d\.]/g, '')) + 1;
	var height = parseInt($("#tempDiv").css('top').replace(/[^-\d\.]/g, '')) + 1;
	$("#tempDiv").remove();
	this.popup.CreateLoadingText(left, top, width, height);
}
View.prototype.CreateLoadingBtn = function(style) {
	var htmlStr = '<div id="tempDiv"></div>';
	$("#" + this.viewObj).append(htmlStr);
	$("#tempDiv").addClass(style);
	var left = parseInt($("#tempDiv").css('left').replace(/[^-\d\.]/g, '')) + 1;
	var top = parseInt($("#tempDiv").css('top').replace(/[^-\d\.]/g, '')) + 1;
	$("#tempDiv").remove();
	return this.popup.AddLoadingBtn(left, top);
}
View.prototype.SetLoadingPopupText = function(text) {
	this.popup.SetLoadingText(text);
}



View.prototype.SetOnMouseOverCallbackFunc = function(func){
	if(WndMgr.MouseClickEnable==false)
	{
		return;	
	}
	if(this.viewObj != null)
	{
		alert("Label.SetOnMouseOverCallbackFunc() set on image_layer");
		
		this.onMouseOverCallbackFunc = func;
		this.EnableOnMouseOver();			
	}
	
}
View.prototype.SetOnMouseOutCallbackFunc = function(func){
	if(WndMgr.MouseClickEnable==false)
	{
		return;	
	}
	if(this.viewObj != null)
	{
		alert("Label.SetOnMouseOutCallbackFunc() set on image_layer");
		
		this.onMouseOutCallbackFunc = func;
		this.EnableOnMouseOut();			
	}
}
View.prototype.EnableOnMouseOver = function(){
	var object = this.viewObj;
	var this_ = this;
	document.getElementById(object).onmouseover = function(){this_.onMouseOverCallbackFunc(this_);};
}
View.prototype.DisableOnMouseOver = function(){
	var object = this.viewObj;
	document.getElementById(object).onmouseover = null;
}
View.prototype.EnableOnMouseOut = function(){
	var object = this.viewObj;
	var this_ = this;
	document.getElementById(object).onmouseout = function(){this_.onMouseOutCallbackFunc(this_);};
}
View.prototype.DisableOnMouseOut = function(){
	var object = this.viewObj;
	document.getElementById(object).onmouseout = null;
}

var popup_coner_width = 34;
var popup_action_top_height = 172;
var popup_action_bottom_height = 106;
var popup_message_top_height = 108;
var popup_message_bottom_height = 34;
var popup_action_inner_box_height = 14;
var popup_action_inner_box_width = 14;
var sublist_coner_width = 27;
var sublist_top_height = 27;
var sublist_bottom_height = 27;
var panel_coner_width = 30;
var panel_top_height = 30;
var panel_bottom_height = 30;

//////////////////////////////////////////////////////////////Action Window Poup(help/no help)///////////////////////////////////////////////////////////////////
function Popup_View(id, type) {
	this.ObjID = id;
	this.TitleLayer = null;
	this.LoadingTextLayer = null;
	this.LoadingBtn = null;

	this.PopupType = type;

	this.main_width = 0;

	this.topHeight = 0;
	this.bottomHeight = 0;
	//commom ui
	//style...
	this.flag_created_title = false;
	this.flag_created_helpbar = false;
	this.HelpEID = null;
 	
}

Popup_View.prototype.Create = function(_left,_top,_width,_height, z_index)
{
	this.main_width = _width;

	this.Initialize(_left,_top,_width,_height,z_index);
	this.Setstyle('.cPopup_bg_alpha', _left, _top, _width, _height);
	this.Setstyle('.cPopup_bg', _left, _top, _width, _height);
	this.SetBGImage();
	if(this.PopupType == 0) {
		this.SetHelpbar(_width, _height);
	}

		
}

//dim
//If x,y is null, popup located center.
//View.prototype.CreateCommonPopup
Popup_View.prototype.Initialize = function(x,y,w,h,z)
{	
//	$("#"+this.ObjID).css('position','absolute');
//	$("#"+this.ObjID).css('left',x+'px');
//	$("#"+this.ObjID).css('top',y+'px');
//	$("#"+this.ObjID).css('width',w+'px');
//	$("#"+this.ObjID).css('height',h+'px');
	if(z!="auto"){
		alert("Popup_View.prototype.Initialize z-index : "+z);
		$("#"+this.ObjID).css('z-index',z);
	}else{
		$("#"+this.ObjID).css('z-index','20');	
	}
	

	var htmlStr = '<div class="cPopup_bg_alpha">';
	htmlStr += '<div class="top"><div class="left"></div><div class="center"></div><div class="right"></div></div>';
	htmlStr += '<div class="mid"><div class="left"></div><div class="center"></div><div class="right"></div></div>';
	htmlStr += '<div class="bottom"><div class="left"></div><div class="center"></div><div class="right"></div></div>';
	htmlStr += '</div>';
	
	htmlStr += '<div class="cPopup_bg">';
	htmlStr += '<div class="top"><div class="left"></div><div class="center"></div><div class="right"></div></div>';
	htmlStr += '<div class="mid"><div class="left"></div><div class="center"></div><div class="right"></div></div>';
	htmlStr += '<div class="bottom"><div class="left"></div><div class="center"></div><div class="right"></div></div>';
	htmlStr += '</div>';

	//optional
	// htmlStr += '<div id="'+this.ObjID+'_title"></div>';
	// htmlStr += '<div id="'+this.ObjID+'_keyhelp"></div>';

	
	$("#" + this.ObjID).append(htmlStr);

	if(this.PopupType == 0)
	{
		this.conerWidth = popup_coner_width;
		this.topHeight = popup_action_top_height;
		this.bottomHeight = popup_action_bottom_height;
	}
	else if(this.PopupType == 1){
		this.conerWidth = popup_coner_width;
		this.topHeight = popup_message_top_height;
		this.bottomHeight = popup_message_bottom_height;
	}
	else if(this.PopupType == 2){
		this.conerWidth = sublist_coner_width;
		this.topHeight = sublist_top_height;
		this.bottomHeight = sublist_bottom_height;
	}
	else if(this.PopupType == 3){
		this.conerWidth = panel_coner_width;
		this.topHeight = panel_top_height;
		this.bottomHeight = panel_bottom_height;
	}	
}

Popup_View.prototype.Setstyle = function(styleType,x,y,w,h)
{	
	var strDIV = "#" + this.ObjID + " " + styleType;
	var strTopDIV = "#" + this.ObjID + " " + styleType + " .top";
	var strMidDIV = "#" + this.ObjID + " " + styleType + " .mid";
	var strBottomDIV = "#" + this.ObjID + " " + styleType + " .bottom";

	
	$(strDIV).css('width', w + 'px');
	$(strDIV).css('height', h + 'px');

	//set style top
	$(strTopDIV).css('width', w + 'px');
	$(strTopDIV).css('height', this.topHeight + 'px');

	$(strTopDIV + " .left").css('height', this.topHeight + 'px');
	$(strTopDIV + " .left").css('width', this.conerWidth + 'px');

	$(strTopDIV + " .center").css('left', this.conerWidth + 'px');
	$(strTopDIV + " .center").css('width', (w - (this.conerWidth * 2)) + 'px');
	$(strTopDIV + " .center").css('height', this.topHeight + 'px');

	$(strTopDIV + " .right").css('left', (w - this.conerWidth) + 'px');
	$(strTopDIV + " .right").css('width', this.conerWidth + 'px');
	$(strTopDIV + " .right").css('height', this.topHeight + 'px');

	
	//set style mid
	$(strMidDIV).css('top', this.topHeight + 'px');
	$(strMidDIV).css('height', (h - this.topHeight - this.bottomHeight) + 'px');

	$(strMidDIV + " .left").css('height', (h - this.topHeight - this.bottomHeight) + 'px');
	$(strMidDIV + " .left").css('width', this.conerWidth + 'px');

	$(strMidDIV + " .center").css('left', this.conerWidth + 'px');
	$(strMidDIV + " .center").css('width', (w - this.conerWidth * 2) + 'px');
	$(strMidDIV + " .center").css('height', (h - this.topHeight - this.bottomHeight) + 'px');

	$(strMidDIV + " .right").css('left', (w - this.conerWidth) + 'px');
	$(strMidDIV + " .right").css('width', this.conerWidth + 'px');
	$(strMidDIV + " .right").css('height', (h - this.topHeight - this.bottomHeight) + 'px');

	//set style bottom
	$(strBottomDIV).css('top', (h - this.bottomHeight) + 'px');
	$(strBottomDIV).css('height', this.bottomHeight + 'px');

	$(strBottomDIV + " .left").css('height', this.bottomHeight + 'px');
	$(strBottomDIV + " .left").css('width', this.conerWidth + 'px');

	$(strBottomDIV + " .center").css('left', this.conerWidth + 'px');
	$(strBottomDIV + " .center").css('width', (w - this.conerWidth * 2) + 'px');
	$(strBottomDIV + " .center").css('height', this.bottomHeight + 'px');

	$(strBottomDIV + " .right").css('left', (w - this.conerWidth) + 'px');
	$(strBottomDIV + " .right").css('width', this.conerWidth + 'px');
	$(strBottomDIV + " .right").css('height', this.bottomHeight + 'px');
}

Popup_View.prototype.SetBGImage = function()
{

	if(this.PopupType == 0)
	{
		$("#" + this.ObjID + " .cPopup_bg_alpha .top .left").css('background-image', 'url(images/720p/common_ui/popup_bg/action/action_window_alpha_topleft.png)');
		$("#" + this.ObjID + " .cPopup_bg_alpha .top .center").css('background-image', 'url(images/720p/common_ui/popup_bg/action/action_window_alpha_topcenter.png)');
		$("#" + this.ObjID + " .cPopup_bg_alpha .top .right").css('background-image', 'url(images/720p/common_ui/popup_bg/action/action_window_alpha_topright.png)');

		$("#" + this.ObjID + " .cPopup_bg_alpha .mid .left").css('background-image', 'url(images/720p/common_ui/popup_bg/action/action_window_alpha_middleleft.png)');
		$("#" + this.ObjID + " .cPopup_bg_alpha .mid .center").css('background-image', 'url(images/720p/common_ui/popup_bg/action/action_window_alpha_middlecenter.png)');
		$("#" + this.ObjID + " .cPopup_bg_alpha .mid .right").css('background-image', 'url(images/720p/common_ui/popup_bg/action/action_window_alpha_middleright.png)');

		$("#" + this.ObjID + " .cPopup_bg_alpha .bottom .left").css('background-image', 'url(images/720p/common_ui/popup_bg/action/action_window_alpha_bottomleft.png)');
		$("#" + this.ObjID + " .cPopup_bg_alpha .bottom .center").css('background-image', 'url(images/720p/common_ui/popup_bg/action/action_window_alpha_bottomcenter.png)');
		$("#" + this.ObjID + " .cPopup_bg_alpha .bottom .right").css('background-image', 'url(images/720p/common_ui/popup_bg/action/action_window_alpha_bottomright.png)');

		$("#" + this.ObjID + " .cPopup_bg .top .left").css('background-image', 'url(images/720p/common_ui/popup_bg/action/action_window_topleft.png)');
		$("#" + this.ObjID + " .cPopup_bg .top .center").css('background-image', 'url(images/720p/common_ui/popup_bg/action/action_window_topcenter.png)');
		$("#" + this.ObjID + " .cPopup_bg .top .right").css('background-image', 'url(images/720p/common_ui/popup_bg/action/action_window_topright.png)');

		$("#" + this.ObjID + " .cPopup_bg .mid .left").css('background-image', 'url(images/720p/common_ui/popup_bg/action/action_window_middleleft.png)');
		$("#" + this.ObjID + " .cPopup_bg .mid .center").css('background-image', 'url(images/720p/common_ui/popup_bg/action/action_window_middlecenter.png)');
		$("#" + this.ObjID + " .cPopup_bg .mid .right").css('background-image', 'url(images/720p/common_ui/popup_bg/action/action_window_middleright.png)');

		$("#" + this.ObjID + " .cPopup_bg .bottom .left").css('background-image', 'url(images/720p/common_ui/popup_bg/action/action_window_bottomleft.png)');
		$("#" + this.ObjID + " .cPopup_bg .bottom .center").css('background-image', 'url(images/720p/common_ui/popup_bg/action/action_window_bottomcenter.png)');
		$("#" + this.ObjID + " .cPopup_bg .bottom .right").css('background-image', 'url(images/720p/common_ui/popup_bg/action/action_window_bottomright.png)');

	}
	else if(this.PopupType == 1){
		$("#" + this.ObjID + " .cPopup_bg_alpha .top .left").css('background-image', 'url(images/720p/common_ui/popup_bg/message/message_popup_alpha_topleft.png)');
		$("#" + this.ObjID + " .cPopup_bg_alpha .top .center").css('background-image', 'url(images/720p/common_ui/popup_bg/message/message_popup_alpha_topcenter.png)');
		$("#" + this.ObjID + " .cPopup_bg_alpha .top .right").css('background-image', 'url(images/720p/common_ui/popup_bg/message/message_popup_alpha_topright.png)');

		$("#" + this.ObjID + " .cPopup_bg_alpha .mid .left").css('background-image', 'url(images/720p/common_ui/popup_bg/message/message_popup_alpha_middleleft.png)');
		$("#" + this.ObjID + " .cPopup_bg_alpha .mid .center").css('background-image', 'url(images/720p/common_ui/popup_bg/message/message_popup_alpha_middlecenter.png)');
		$("#" + this.ObjID + " .cPopup_bg_alpha .mid .right").css('background-image', 'url(images/720p/common_ui/popup_bg/message/message_popup_alpha_middleright.png)');

		$("#" + this.ObjID + " .cPopup_bg_alpha .bottom .left").css('background-image', 'url(images/720p/common_ui/popup_bg/message/message_popup_alpha_bottomleft.png)');
		$("#" + this.ObjID + " .cPopup_bg_alpha .bottom .center").css('background-image', 'url(images/720p/common_ui/popup_bg/message/message_popup_alpha_bottomcenter.png)');
		$("#" + this.ObjID + " .cPopup_bg_alpha .bottom .right").css('background-image', 'url(images/720p/common_ui/popup_bg/message/message_popup_alpha_bottomright.png)');


		$("#" + this.ObjID + " .cPopup_bg .top .left").css('background-image', 'url(images/720p/common_ui/popup_bg/message/message_popup_topleft.png)');
		$("#" + this.ObjID + " .cPopup_bg .top .center").css('background-image', 'url(images/720p/common_ui/popup_bg/message/message_popup_topcenter.png)');
		$("#" + this.ObjID + " .cPopup_bg .top .right").css('background-image', 'url(images/720p/common_ui/popup_bg/message/message_popup_topright.png)');

		$("#" + this.ObjID + " .cPopup_bg .mid .left").css('background-image', 'url(images/720p/common_ui/popup_bg/message/message_popup_middleleft.png)');
		$("#" + this.ObjID + " .cPopup_bg .mid .center").css('background-image', 'url(images/720p/common_ui/popup_bg/message/message_popup_middlecenter.png)');
		$("#" + this.ObjID + " .cPopup_bg .mid .right").css('background-image', 'url(images/720p/common_ui/popup_bg/message/message_popup_middleright.png)');

		$("#" + this.ObjID + " .cPopup_bg .bottom .left").css('background-image', 'url(images/720p/common_ui/popup_bg/message/message_popup_bottomleft.png)');
		$("#" + this.ObjID + " .cPopup_bg .bottom .center").css('background-image', 'url(images/720p/common_ui/popup_bg/message/message_popup_bottomcenter.png)');
		$("#" + this.ObjID + " .cPopup_bg .bottom .right").css('background-image', 'url(images/720p/common_ui/popup_bg/message/message_popup_bottomright.png)');
	}	
	else if(this.PopupType == 2)
	{

		$("#" + this.ObjID + " .cPopup_bg_alpha .top .left").css('background-image', 'url(images/720p/common_ui/popup_bg/sub_list_popup/sublist_bg_alpha_lt.png)');
		$("#" + this.ObjID + " .cPopup_bg_alpha .top .center").css('background-image', 'url(images/720p/common_ui/popup_bg/sub_list_popup/sublist_bg_alpha_tc.png)');
		$("#" + this.ObjID + " .cPopup_bg_alpha .top .right").css('background-image', 'url(images/720p/common_ui/popup_bg/sub_list_popup/sublist_bg_alpha_rt.png)');

		$("#" + this.ObjID + " .cPopup_bg_alpha .mid .left").css('background-image', 'url(images/720p/common_ui/popup_bg/sub_list_popup/sublist_bg_alpha_lc.png)');
		$("#" + this.ObjID + " .cPopup_bg_alpha .mid .center").css('background-image', 'url(images/720p/common_ui/popup_bg/sub_list_popup/sublist_bg_alpha_cc.png)');
		$("#" + this.ObjID + " .cPopup_bg_alpha .mid .right").css('background-image', 'url(images/720p/common_ui/popup_bg/sub_list_popup/sublist_bg_alpha_rc.png)');

		$("#" + this.ObjID + " .cPopup_bg_alpha .bottom .left").css('background-image', 'url(images/720p/common_ui/popup_bg/sub_list_popup/sublist_bg_alpha_lb.png)');
		$("#" + this.ObjID + " .cPopup_bg_alpha .bottom .center").css('background-image', 'url(images/720p/common_ui/popup_bg/sub_list_popup/sublist_bg_alpha_bc.png)');
		$("#" + this.ObjID + " .cPopup_bg_alpha .bottom .right").css('background-image', 'url(images/720p/common_ui/popup_bg/sub_list_popup/sublist_bg_alpha_rb.png)');

	
		$("#" + this.ObjID + " .cPopup_bg .top .left").css('background-image', 'url(images/720p/common_ui/popup_bg/sub_list_popup/sublist_bg_lt.png)');
		$("#" + this.ObjID + " .cPopup_bg .top .center").css('background-image', 'url(images/720p/common_ui/popup_bg/sub_list_popup/sublist_bg_tc.png)');
		$("#" + this.ObjID + " .cPopup_bg .top .right").css('background-image', 'url(images/720p/common_ui/popup_bg/sub_list_popup/sublist_bg_rt.png)');

		$("#" + this.ObjID + " .cPopup_bg .mid .left").css('background-image', 'url(images/720p/common_ui/popup_bg/sub_list_popup/sublist_bg_lc.png)');
		$("#" + this.ObjID + " .cPopup_bg .mid .center").css('background-image', 'url(images/720p/common_ui/popup_bg/sub_list_popup/sublist_bg_cc.png)');
		$("#" + this.ObjID + " .cPopup_bg .mid .right").css('background-image', 'url(images/720p/common_ui/popup_bg/sub_list_popup/sublist_bg_rc.png)');

		$("#" + this.ObjID + " .cPopup_bg .bottom .left").css('background-image', 'url(images/720p/common_ui/popup_bg/sub_list_popup/sublist_bg_lb.png)');
		$("#" + this.ObjID + " .cPopup_bg .bottom .center").css('background-image', 'url(images/720p/common_ui/popup_bg/sub_list_popup/sublist_bg_bc.png)');
		$("#" + this.ObjID + " .cPopup_bg .bottom .right").css('background-image', 'url(images/720p/common_ui/popup_bg/sub_list_popup/sublist_bg_rb.png)');
	}
	else if(this.PopupType == 3)
	{

		$("#" + this.ObjID + " .cPopup_bg_alpha .top .left").css('background-image', 'url(images/720p/common_ui/popup_bg/panel_nohelp/panel_nohelp_alpha_lt.png)');
		$("#" + this.ObjID + " .cPopup_bg_alpha .top .center").css('background-image', 'url(images/720p/common_ui/popup_bg/panel_nohelp/panel_nohelp_alpha_ct.png)');
		$("#" + this.ObjID + " .cPopup_bg_alpha .top .right").css('background-image', 'url(images/720p/common_ui/popup_bg/panel_nohelp/panel_nohelp_alpha_rt.png)');

		$("#" + this.ObjID + " .cPopup_bg_alpha .mid .left").css('background-image', 'url(images/720p/common_ui/popup_bg/panel_nohelp/panel_nohelp_alpha_lc.png)');
		$("#" + this.ObjID + " .cPopup_bg_alpha .mid .center").css('background-image', 'url(images/720p/common_ui/popup_bg/panel_nohelp/panel_nohelp_alpha_cc.png)');
		$("#" + this.ObjID + " .cPopup_bg_alpha .mid .right").css('background-image', 'url(images/720p/common_ui/popup_bg/panel_nohelp/panel_nohelp_alpha_rc.png)');

		$("#" + this.ObjID + " .cPopup_bg_alpha .bottom .left").css('background-image', 'url(images/720p/common_ui/popup_bg/panel_nohelp/panel_nohelp_alpha_lb.png)');
		$("#" + this.ObjID + " .cPopup_bg_alpha .bottom .center").css('background-image', 'url(images/720p/common_ui/popup_bg/panel_nohelp/panel_nohelp_alpha_cb.png)');
		$("#" + this.ObjID + " .cPopup_bg_alpha .bottom .right").css('background-image', 'url(images/720p/common_ui/popup_bg/panel_nohelp/panel_nohelp_alpha_rb.png)');

	
		$("#" + this.ObjID + " .cPopup_bg .top .left").css('background-image', 'url(images/720p/common_ui/popup_bg/panel_nohelp/panel_nohelp_lt.png)');
		$("#" + this.ObjID + " .cPopup_bg .top .center").css('background-image', 'url(images/720p/common_ui/popup_bg/panel_nohelp/panel_nohelp_ct.png)');
		$("#" + this.ObjID + " .cPopup_bg .top .right").css('background-image', 'url(images/720p/common_ui/popup_bg/panel_nohelp/panel_nohelp_rt.png)');

		$("#" + this.ObjID + " .cPopup_bg .mid .left").css('background-image', 'url(images/720p/common_ui/popup_bg/panel_nohelp/panel_nohelp_lc.png)');
		//$("#" + this.ObjID + " .cPopup_bg .mid .center").css('background-image', 'url(images/720p/common_ui/popup_bg/panel_nohelp/panel_nohelp_cc.png)');
		$("#" + this.ObjID + " .cPopup_bg .mid .right").css('background-image', 'url(images/720p/common_ui/popup_bg/panel_nohelp/panel_nohelp_rc.png)');

		$("#" + this.ObjID + " .cPopup_bg .bottom .left").css('background-image', 'url(images/720p/common_ui/popup_bg/panel_nohelp/panel_nohelp_lb.png)');
		$("#" + this.ObjID + " .cPopup_bg .bottom .center").css('background-image', 'url(images/720p/common_ui/popup_bg/panel_nohelp/panel_nohelp_cb.png)');
		$("#" + this.ObjID + " .cPopup_bg .bottom .right").css('background-image', 'url(images/720p/common_ui/popup_bg/panel_nohelp/panel_nohelp_rb.png)');
	}
}
Popup_View.prototype.CreateInnerBox = function() {
	//var htmlStr = $("#" + this.ObjID).html(); //modify 9.18
	var htmlStr = "";
	
	htmlStr += '<div class="cPopup_innerbox">';
	htmlStr += '<div class="top"><div class="left"></div><div class="center"></div><div class="right"></div></div>';
	htmlStr += '<div class="mid"><div class="left"></div><div class="center"></div><div class="right"></div></div>';
	htmlStr += '<div class="bottom"><div class="left"></div><div class="center"></div><div class="right"></div></div>';
	htmlStr += '</div>';
	//$("#" + this.ObjID).html(htmlStr); //modify
	$("#" + this.ObjID).append(htmlStr);

}
Popup_View.prototype.SetInnerboxStyle = function(l,t,w, h) {
	/*
	alert("innerbox left : " + l);
	alert("innerbox top : " + t);
	alert("innerbox width : " + w);
		alert("innerbox height : " + h);*/
	
	//added 8.24
	$("#" + this.ObjID + " .cPopup_innerbox").css('left', l + 'px');
	$("#" + this.ObjID + " .cPopup_innerbox").css('top', t + 'px');
	$("#" + this.ObjID + " .cPopup_innerbox").css('width', w + 'px');
	$("#" + this.ObjID + " .cPopup_innerbox").css('height', h + 'px');

	//set style top
	$("#" + this.ObjID + " .cPopup_innerbox .top").css('width', w + 'px');
	$("#" + this.ObjID + " .cPopup_innerbox .top").css('height', popup_action_inner_box_height + 'px');

	$("#" + this.ObjID + " .cPopup_innerbox .top .left").css('height', popup_action_inner_box_height + 'px');

	$("#" + this.ObjID + " .cPopup_innerbox .top .center").css('width', (w - (popup_action_inner_box_width * 2)) + 'px');
	$("#" + this.ObjID + " .cPopup_innerbox .top .center").css('height', popup_action_inner_box_height + 'px');

	$("#" + this.ObjID + " .cPopup_innerbox .top .right").css('left', (w - popup_action_inner_box_width) + 'px');
	$("#" + this.ObjID + " .cPopup_innerbox .top .right").css('height', popup_action_inner_box_height + 'px');

	//set style mid
	$("#" + this.ObjID + " .cPopup_innerbox .mid").css('top', popup_action_inner_box_height + 'px');
	$("#" + this.ObjID + " .cPopup_innerbox .mid").css('height', (h - popup_action_inner_box_height - popup_action_inner_box_height) + 'px');

	$("#" + this.ObjID + " .cPopup_innerbox .mid .left").css('height', (h - popup_action_inner_box_height - popup_action_inner_box_height) + 'px');

	$("#" + this.ObjID + " .cPopup_innerbox .mid .center").css('width', (w - popup_action_inner_box_width * 2) + 'px');
	$("#" + this.ObjID + " .cPopup_innerbox .mid .center").css('height', (h - popup_action_inner_box_height - popup_action_inner_box_height) + 'px');

	$("#" + this.ObjID + " .cPopup_innerbox .mid .right").css('left', (w - popup_action_inner_box_width) + 'px');
	$("#" + this.ObjID + " .cPopup_innerbox .mid .right").css('height', (h - popup_action_inner_box_height - popup_action_inner_box_height) + 'px');

	//set style bottom
	$("#" + this.ObjID + " .cPopup_innerbox .bottom").css('top', (h - popup_action_inner_box_height) + 'px');
	$("#" + this.ObjID + " .cPopup_innerbox .bottom").css('height', popup_action_inner_box_height + 'px');

	$("#" + this.ObjID + " .cPopup_innerbox .bottom .left").css('height', popup_action_inner_box_height + 'px');

	$("#" + this.ObjID + " .cPopup_innerbox .bottom .center").css('width', (w - popup_action_inner_box_width * 2) + 'px');
	$("#" + this.ObjID + " .cPopup_innerbox .bottom .center").css('height', popup_action_inner_box_height + 'px');

	$("#" + this.ObjID + " .cPopup_innerbox .bottom .right").css('left', (w - popup_action_inner_box_width) + 'px');
	$("#" + this.ObjID + " .cPopup_innerbox .bottom .right").css('height', popup_action_inner_box_height + 'px');

	
	//set background image
	$("#" + this.ObjID + " .cPopup_innerbox .top .left").css('background-image', 'url(images/720p/common_ui/popup_bg/inner_box/action_window_innerbox_topleft.png)');
	$("#" + this.ObjID + " .cPopup_innerbox .top .center").css('background-image', 'url(images/720p/common_ui/popup_bg/inner_box/action_window_innerbox_topcenter.png)');
	$("#" + this.ObjID + " .cPopup_innerbox .top .right").css('background-image', 'url(images/720p/common_ui/popup_bg/inner_box/action_window_innerbox_topright.png)');

	$("#" + this.ObjID + " .cPopup_innerbox .mid .left").css('background-image', 'url(images/720p/common_ui/popup_bg/inner_box/action_window_innerbox_middleleft.png)');
	$("#" + this.ObjID + " .cPopup_innerbox .mid .center").css('background-image', 'url(images/720p/common_ui/popup_bg/inner_box/action_window_innerbox_middlecenter.png)');
	$("#" + this.ObjID + " .cPopup_innerbox .mid .right").css('background-image', 'url(images/720p/common_ui/popup_bg/inner_box/action_window_innerbox_middleright.png)');

	$("#" + this.ObjID + " .cPopup_innerbox .bottom .left").css('background-image', 'url(images/720p/common_ui/popup_bg/inner_box/action_window_innerbox_bottomleft.png)');
	$("#" + this.ObjID + " .cPopup_innerbox .bottom .center").css('background-image', 'url(images/720p/common_ui/popup_bg/inner_box/action_window_innerbox_bottomcenter.png)');
	$("#" + this.ObjID + " .cPopup_innerbox .bottom .right").css('background-image', 'url(images/720p/common_ui/popup_bg/inner_box/action_window_innerbox_bottomright.png)');

}

Popup_View.prototype.AddLoadingBtn = function(left, top) {
	var htmlStr = '<div id="' + this.ObjID + '_loading_btn"><div id="' + this.ObjID + '_loading_btn_text"</div>';
	$("#" + this.ObjID).append(htmlStr);
	$("#" + this.ObjID + '_loading_btn').css('position', 'absolute');
	$("#" + this.ObjID + '_loading_btn').css('left', left + 'px');
	$("#" + this.ObjID + '_loading_btn').css('top', top + 'px');
	$("#" + this.ObjID + '_loading_btn').css('width', '162px');
	$("#" + this.ObjID + '_loading_btn').css('height', '53px');
	$("#" + this.ObjID + '_loading_btn').css('z-index', '20');

	$("#" + this.ObjID + '_loading_btn_text').css('position', 'absolute');
	$("#" + this.ObjID + '_loading_btn_text').css('left', '0px');
	$("#" + this.ObjID + '_loading_btn_text').css('top', '15px');
	$("#" + this.ObjID + '_loading_btn_text').css('height', '53px');
	$("#" + this.ObjID + '_loading_btn_text').css('width', '162px');
	$("#" + this.ObjID + '_loading_btn_text').css('z-index', '20');

	
	
	var btn = new Button();
	btn.SetImageObjId(this.ObjID + '_loading_btn', 20);
	btn.SetBgImage(BtnImgIndex.BTN_NORMAL_IMG, g_Image.IMAGE_POPUP_BTN_NORMAL);
	btn.SetBgImage(BtnImgIndex.BTN_NORMAL_FOCUS_IMG, g_Image.IMAGE_POPUP_BTN_NORMALFOCUS);
	btn.SetBgImage(BtnImgIndex.BTN_DIM_IMG, g_Image.IMAGE_POPUP_BTN_DIM);
	btn.SetTextObjId(this.ObjID + '_loading_btn_text');

	btn.SetTextStyle(BtnTextStyleIndex.BTN_TEXT_NORMAL_STYLE, "cPopup_btn_text");
	btn.SetTextStyle(BtnTextStyleIndex.BTN_TEXT_DIM_STYLE, "cPopup_btn_text_dim");

	return btn;

	
	
}
Popup_View.prototype.SetLoadingBG = function(imgUrl) {
	$("#" + this.ObjID + '_loading').css('background-image', 'url(' + imgUrl + ')');
}
Popup_View.prototype.CreateLoadingText = function(left, top, width, height) {
	var htmlStr = '<div id="' + this.ObjID + '_loading_text"></div>';
	$("#" + this.ObjID).append(htmlStr);

	
	$("#" + this.ObjID + '_loading_text').addClass('cPopup_loading_text');
	$("#" + this.ObjID + '_loading_text').css('left', left + 'px');
	$("#" + this.ObjID + '_loading_text').css('top', top + 'px');
	$("#" + this.ObjID + '_loading_text').css('width', width + 'px');
	$("#" + this.ObjID + '_loading_text').css('height', height + 'px');

	this.LoadingTextLayer = new TextLayer(this.ObjID + '_loading_text');
}
Popup_View.prototype.SetLoadingText = function(text) {

	this.LoadingTextLayer.SetText(text);
}
Popup_View.prototype.CreateLoading = function(icon_left, icon_top) {
	var htmlStr = '<div id="' + this.ObjID + '_loading"></div>';

	$("#" + this.ObjID).append(htmlStr);

	$("#" + this.ObjID + '_loading').addClass('cPopup_loading_icon');
	$("#" + this.ObjID + '_loading').css('left', icon_left + 'px');
	$("#" + this.ObjID + '_loading').css('top', icon_top + 'px');
}

Popup_View.prototype.CreateTitle = function()
{
	if(this.flag_created_title == false)
	{
		var htmlStr = '<div id="' + this.ObjID + '_title"></div>';
		$("#" + this.ObjID).append(htmlStr);

		
		$('#' + this.ObjID + '_title').addClass('cPopup_title');
		$('#' + this.ObjID + '_title').css('width', (this.main_width - 60) + 'px');

		//$('#'+this.ObjID+'_title').sfLabel({text:"test_Title"});

		this.TitleLayer = new TextLayer(this.ObjID + '_title');

		this.flag_created_title = true;
	}

}

Popup_View.prototype.SetTitleText = function(title_txt)
{
	this.TitleLayer.SetText(title_txt);
}



Popup_View.prototype.SetHelpbar = function(w,h)
{
	var htmlStr = '<div id="' + this.ObjID + '_keyhelp"></div>';
	$("#" + this.ObjID).append(htmlStr);

	$('#' + this.ObjID + '_keyhelp').addClass('cPopup_help');
	$('#' + this.ObjID + '_keyhelp').css('top', (h - 60) + 'px');
	$('#' + this.ObjID + '_keyhelp').css('width', (w - 30) + 'px');

	$('#' + this.ObjID + '_keyhelp').sfKeyHelp({
		'theme' : 'TRANSPARENT',
		'return' : SID_RETURN
	});
	
	this.HelpEID = '#' + this.ObjID + '_keyhelp';

	$('#' + this.ObjID + '_keyhelp').css('background-image', 'url()');
	//$('#'+this.ObjID+'_keyhelp').css('background-color','#FF00FF');
	//$('#'+this.ObjID+'_keyhelp .sf-ui-keyhelp').css('display','none');
	this.flag_created_helpbar = true;

}

// parametar ex) { 'enter': SID_ENTER , 'return' : SID_RETURN} 
//return  / enter / red / green / yellow / blue / tools / leftright / updown / number / ime / info ....

Popup_View.prototype.ChangeHelpbar = function(HelpbarData)
{
	// if(this.flag_created_helpbar == true)
	// {		
		// $('#' + this.ObjID + '_keyhelp').sfKeyHelp(HelpbarData);
	// }	
	
	if(this.flag_created_helpbar == true) {
		$(this.HelpEID).sfKeyHelp(HelpbarData);

		if(HelpbarData.play != null) {
			if(ResMgr.GetCurLanguage()==ENUM_TV_LANGUAGE.KOR){
				$(this.HelpEID  + ' .sf-ui-keyhelp-icon-play').css('background-image', 'url(images/720p/helpicon/c/icon_help_prech_ko.png)');
				$(this.HelpEID  + ' .sf-ui-keyhelp-icon-play').css('background-position', '0px 1px');
				$(this.HelpEID  + ' .sf-ui-keyhelp-icon-play').css('width', '87px');
			}else{
				$(this.HelpEID  + ' .sf-ui-keyhelp-icon-play').css('background-image', 'url(images/720p/helpicon/c/icon_help_prech.png)');
				$(this.HelpEID  + ' .sf-ui-keyhelp-icon-play').css('background-position', '0px 1px');
				$(this.HelpEID  + ' .sf-ui-keyhelp-icon-play').css('width', '65px');	
			}
		}
		if(HelpbarData.stop != null) {
			if(ProcMgr.isTTXMIX == true){		//EU
				$(this.HelpEID  + ' .sf-ui-keyhelp-icon-stop').css('background-image', 'url(images/720p/helpicon/c/icon_help_ttx.png)');
				$(this.HelpEID  + ' .sf-ui-keyhelp-icon-stop').css('background-position', '0px 1px');
				$(this.HelpEID  + ' .sf-ui-keyhelp-icon-stop').css('width', '43px');
			}else{									
				$(this.HelpEID  + ' .sf-ui-keyhelp-icon-stop').css('background-image', 'url(images/720p/helpicon/c/icon_help_dash.png)');
				$(this.HelpEID  + ' .sf-ui-keyhelp-icon-stop').css('background-position', '0px 1px');
				$(this.HelpEID  + ' .sf-ui-keyhelp-icon-stop').css('width', '26px');
			}
		}
		if(HelpbarData.ff != null) {
				$(this.HelpEID  + ' .sf-ui-keyhelp-icon-ff').css('background-image', 'url(images/720p/helpicon/c/icon_help_num.png)');
				$(this.HelpEID  + ' .sf-ui-keyhelp-icon-ff').css('background-position', '0px 1px');
				$(this.HelpEID  + ' .sf-ui-keyhelp-icon-ff').css('width', '52px');	
		}
	}

	
	
}

Popup_View.prototype.ChangeBGSize = function(x,y,w,h)
{	
	$("#"+this.ObjID).css('left',x+'px');
	$("#"+this.ObjID).css('top',y+'px');
	$("#"+this.ObjID).css('width',w+'px');
	$("#"+this.ObjID).css('height',h+'px');
	this.Setstyle('.cPopup_bg_alpha', x, y, w, h);
	this.Setstyle('.cPopup_bg', x, y, w, h);

	if(this.flag_created_title == true)
	{
		$('#' + this.ObjID + '_title').css('width', (w - 60) + 'px');
	}
	// modify 8.14
	if(this.PopupType == 0) {
		$('#' + this.ObjID + '_keyhelp').css('top', (h - 60) + 'px');
		$('#' + this.ObjID + '_keyhelp').css('width', (w - 30) + 'px');
	}
}
////////////////////////////////////////////////////////////Message Popup///////////////////////////////////////////////////////////////////////////////////


//Push Popup
