this.panelid = "#th_popMessage_1";
this.closebtn= "#thclosebtn";
this.newsList = "#th_ul_newsList";
this.topheader = "#topheader337";
this.timer = null;
$(this.closebtn).click(function(){$("#th_popMessage_1").fadeOut();return false;});
this.defaultStyleClass = "top_notice_1";
this.miniStyleClass = "top_notice_2";
$(this.panelid).attr("class",this.defaultStyleClass);
};
TopHeader.prototype= {
show_notification:function(data,relaviteEleId,miniType){
// reset
$(this.panelid).hide();
//
if(relaviteEleId != "undefined"){
relaviteEleId = "#"+ relaviteEleId;
this.setRelativePos(relaviteEleId);
}
if(data != "undefined" && data != null){
this.setdata(data);
}
// set style
if(miniType == true){
$(this.panelid).attr("class",this.miniStyleClass);
}
else{
$(this.panelid).attr("class",this.defaultStyleClass);
}
// show
$(this.panelid).slideDown("slow");
// auto close
var milisec = 60000;
me_th = this;
me_th.timer = setTimeout("me_th.closebox()", milisec);
$(this.panelid).mouseover(function(){clearTimeout(me_th.timer)});
},
setRelativePos:function(targetId){
var pos = $(targetId).offset();
var thpos = $(this.topheader).offset();
var hgt = $(this.topheader).height();
var wth = $(targetId).width();
var myWth = $(this.panelid).width();
if(pos != null){
$(this.panelid).css(
{ "position": "absolute", "left": (pos.left + wth - myWth) + "px", "top":(thpos.top + hgt + 3)+ "px" } );
}
else{
var windowWidth = document.documentElement.clientWidth;
var pos = $(this.topheader).offset();
var hgt = $(this.topheader).height();
$(this.panelid).css(
{ "position": "absolute", "left": (windowWidth - myWth - 5) + "px", "top": (pos.top + hgt) + "px" } );
}
},
setdata:function(data){
$(this.newsList).empty();
var item;
for(var i = 0; i < data.length ; i ++){ item = data[i]; var child = "
$(this.newsList).append(child);
}
},
closebox:function(){
$(this.panelid).fadeOut();
}
};
//
// Popup menu
//