﻿Listener.add(window,"load",function(){

window.GRNDIA = {} ;

var d = document ;
var $id = function(id){return document.getElementById(id)};
var $tag = function(tag,parent){
	if(!parent) parent = d ;
	return parent.getElementsByTagName(tag);
};

var addClass = function(node,value){
	var currentclass = node.className ;
	var regclass = new RegExp("\\b" + value + "\\b","g");
	if(!currentclass) currentclass = value ;
	else if(currentclass.search(regclass) != -1) return ;
	else currentclass += " " + value ;
	node.className = currentclass ;
};

var removeClass = function(node,value){
	var currentclass = node.className ;
	var regclass = new RegExp("\\b" + value + "\\b","g");
	var regblank = /\b\s*\s$/;
	if(currentclass == value) node.removeAttribute("class") || node.removeAttribute("className");
	else if(currentclass.search(regclass) == -1) return ;
	else {
		currentclass = currentclass.replace(regclass,"");
		currentclass = currentclass.replace(regblank,"");
		node.className = currentclass ;
	}
};

var hasClass = function(node,value){
	if(node == "body") node = d.body ;
	else if(typeof node == "string") node = $id(node);
	var currentclass = node.className ;
	var regclass = new RegExp("\\b" + value + "\\b","g");
	if(currentclass.search(regclass) == -1) return false ;
	else return true ;
};


// other popup Settings /////////////////////////
(function(){
			 
	var a = d.links ;
	var isIE = "\v"=="v";
	var isIE6 = (typeof document.body.style.maxHeight == "undefined");

	for(var i = 0 ; i < a.length; i++){
		var reg = /popup=(.+)&(.+)$/i;
		var rel = a[i].getAttribute("rel");
		
		if(!rel) continue ;
		
		if(rel.match(reg) != null){				
			Listener.add(a[i],"click",function(e){
				var rel = this.getAttribute("rel");
				
				rel.match(reg)
				var name = RegExp.$1;
				var param = RegExp.$2;
				if(param == "full"){
					var width = window.screen.availWidth ;
					var height = window.screen.availHeight ;
					var left = 0 ;
					var top = 0 ;
					var scrl = "no";
					if(isIE6){
						width = width -10 ;
						height = height -29 ;
					}
				}
				else {
					data = param.split("+");
					var width = isIE?(parseInt(data[0])+17):(data[0]);
					var height = data[1];
					var top = (window.screen.height/2) - (height/2) ;
					var left = (window.screen.width/2) - (width/2) ;
					var scrl = "yes";
				}
				
				var popup = window.open(this.href,name,'width=' + width + ', height=' + height + ', menubar=no, toolbar=no, scrollbars=' + scrl + ' ,top=' + top + ' ,left=' + left);
				if(popup) popup.focus();
				
				e.preventDefault();
				e.stopPropagation();
			});
		}
	}
})();	


});


function ComingSoon(){
	void 0 ;
}

