/* За основу взят класс от DANNEO CMS                   */
/* ==================================================== ##
##             COPYRIGHTS © DANNEO PHP TEAM             ##
## ==================================================== ##
## PRODUCT : CMS(CONTENT MANAGEMENT SYSTEM)             ##
## LICENSE : GNU 2(General Public License v.2)          ##
## TECHNOLOGIES : PHP & MySQL                           ##
## WWW : www.danneo.com | www.danneo.org                ##
## E-MAIL : help@danneo.com                             ##
## ==================================================== */
// CLASS : DN_System_Load
// Init
function DN_System_Load(){
this.wib = screen.width;
this.heb = screen.height;
this.documes = (document.getElementById || document.createElement || document.getElementsByTagName) ? true : false;
this.objects = window.addEventListener || window.attachEvent ? window : document.addEventListener ? document : null;
this.types = 'load';
}
// ADDSEVENT - нужно
DN_System_Load.prototype.addsevent = function(func){
if(this.objects.addEventListener){
this.objects.addEventListener(this.types,func,false);
return true;
} else if (this.objects.attachEvent){
this.objects.attachEvent("on" + this.types,func);
} else {
return false;
}
}
// FIND OBJ  - нужно
DN_System_Load.prototype.findobj = function(obj){
this.parent = window.document;
if(this.parent.getElementById && this.parent.getElementById(obj)){ return this.parent.getElementById(obj); }
if(this.parent[obj]){ return this.parent[obj]; }
if(this.parent.all && this.parent.all[obj]){ return this.parent.all[obj]; }
if(this.parent.layers && this.parent.layers[obj]){ return this.parent.layers[obj]; }
return null;
}
// BROWSER
DN_System_Load.prototype.browser = function(){
 this.ver = navigator.appVersion;
 this.agent = navigator.userAgent.toLowerCase();
 this.dom = document.getElementById ? 1:0;
 this.all = document.all ? 1:0;
 this.ie5 = (this.ver.indexOf("MSIE 5")>-1 && this.dom) ? 1:0;
 this.ie6 = (this.ver.indexOf("MSIE 6")>-1 && this.dom) ? 1:0;
 this.ie4 = (document.all && !this.dom) ? 1:0;
 this.ie = this.ie4 || this.ie5 || this.ie6;
 this.opera = this.agent.indexOf("opera")>-1;
 this.gecko = (this.agent.indexOf("gecko")!=-1) ? 1:0;
 this.bw = (this.ie || this.opera || this.gecko);
 return this;
}
// FIND OBJ
DN_System_Load.prototype.findobj = function(obj){
this.parent = window.document;
if(this.parent[obj]){ return this.parent[obj]; }
if(this.parent.all && this.parent.all[obj]){ return this.parent.all[obj]; }
if(this.parent.layers && this.parent.layers[obj]){ return this.parent.layers[obj]; }
if(this.parent.getElementById && this.parent.getElementById(obj)){ return this.parent.getElementById(obj); }
return null;
}




// CLASS : DN_System_Load


// INIT CLASS
var DN = new DN_System_Load();
// INIT CLASS


// CLASS : DN_AJAX_Initialize
// Init
function DN_AJAX_Initialize(works){
this.works = works ? true : false;
this.reqxml = '';
this.data = '';
}
// Create
DN_AJAX_Initialize.prototype.create = function(){
if(!this.works){ return false; }
var msxmllist = new Array('Msxml2.XMLHTTP.3.0','Msxml2.XMLHTTP.4.0','Msxml2.XMLHTTP.5.0',
                          'Msxml2.XMLHTTP','Microsoft.XMLHTTP');
for(var i=0; i<msxmllist.length; i++){
 try {
  this.reqxml = new ActiveXObject(msxmllist[i]);
  if(this.reqxml){ return true; }
 } catch(e){}
}

if(!this.reqxml && typeof XMLHttpRequest!="undefined"){
 this.reqxml = new XMLHttpRequest();
 if(this.reqxml){ return true; }
}
return false;
}



// CLASS : DN_AJAX_Initialize


// INIT CLASS
if(DN.browser().bw==1){
var AJAX = new DN_AJAX_Initialize(true);
} else {
var AJAX = new DN_AJAX_Initialize(false);
}

//var AJAX = new DN_AJAX_Initialize(true);

// INIT CLASS


// CLASS : DN_System_Hint
// Init
function DN_System_Hint(){}
// SHOW
DN_System_Hint.prototype.show = function(obj,str){
var hint = DN.findobj('hint');
if(!obj){ return; }
if(!DN.documes){ return; }
if(!hint){ return; }
hint.className = 'hint';
hint.style.left = 15;
hint.style.top = 19;

obj.onmouseout = function(advance){
hint.style.width = '';
hint.style.visibility = 'hidden';
if(hint.firstChild) hint.removeChild(hint.firstChild);
hint.appendChild(document.createTextNode(str));
};

obj.onmousemove = function(advance){
hint.style.width = '';
hint.innerHTML = str;
vc = document.getElementsByTagName((document.compatMode && document.compatMode=="CSS1Compat") ? "HTML":"BODY")[0];
x = window.event ? event.clientX + vc.scrollLeft : advance.pageX;
y = window.event ? event.clientY + vc.scrollTop : advance.pageY;
vcwidth = vc.clientWidth ? vc.clientWidth + vc.scrollLeft : window.innerWidth + window.pageXOffset;
vcheight = vc.innerHeight ? window.innerHeight + window.pageYOffset : vc.clientHeight + vc.scrollTop;
  if(hint.offsetWidth>200){ hint.style.width = '200'; }
  if((x + hint.offsetWidth + 15) > vcwidth){
   hint.style.left = x - hint.offsetWidth - 4;
  } else {
   hint.style.left = x + 15;
  }
  if((y + hint.offsetHeight + 19) > vcheight){
   hint.style.top = y - hint.offsetHeight;
  } else {
   hint.style.top = y + 19;
  }
  //if(typeof(hint.style.MozOpacity)!="undefined"){
  hint.style.opacity = '.85';
  hint.style.filter = "alpha(opacity:85)";
  //}
  hint.style.visibility = 'visible';
};
}
// INITIALIZE
DN_System_Hint.prototype.initialize = function(){
// CREATE DIV
var hint = document.createElement("DIV");
hint.setAttribute('id','hint');
document.getElementsByTagName('body')[0].appendChild(hint);
hint.style.visibility = 'hidden';
// CREATE DIV
// MARKER
//var hintmarker = ['a','img'];
var hintmarker = ['p','a','img','checkbox'];
//var hintmarker = ['a_alt','p_title'];
var textmarker = ['title','alt'];
var lenmarker = hintmarker.length;

var table = document.getElementById('table_cont')
// MARKER
for(var i=0; i<lenmarker; i++) {
  atr = table.getElementsByTagName(hintmarker[i]);
//  atr = document.getElementsByTagName(hintmarker[i]);
// atr = document.getElementsById(hintmarker[i]);
 for(var j=0; j<atr.length; j++)
 if(viewhint=atr[j].getAttribute(textmarker[i])){
  atr[j].removeAttribute(textmarker[i]);
  HINT.show(atr[j],viewhint);
 }
}


var table = document.getElementById('table_cont1')
// MARKER
for(var i=0; i<lenmarker; i++) {
  atr = table.getElementsByTagName(hintmarker[i]);
//  atr = document.getElementsByTagName(hintmarker[i]);
// atr = document.getElementsById(hintmarker[i]);
 for(var j=0; j<atr.length; j++)
 if(viewhint=atr[j].getAttribute(textmarker[i])){
  atr[j].removeAttribute(textmarker[i]);
  HINT.show(atr[j],viewhint);
 }
}



}
// CLASS : DN_System_Hint

// INIT CLASS
var HINT = new DN_System_Hint();
// INIT CLASS
// LOAD || ONLOAD
if(DN.objects){ DN.addsevent(HINT.initialize); }

