window.DTK = {
	
	addWindowLoadEvent: function(func){
		 if(func){
			 if (window.addEventListener){
	         window.addEventListener("load", func, false);
	     }
	     else{
	         window.attachEvent("onload", func);
	     }
     }
     else{return false;}		
	},
	
	removeBreadcrumb: function(){
		var ele = document.getElementById('content_area');
		var tables = ele.getElementsByTagName('table');
		var toremove = tables[0];

		//if(toremove.getElementsByTagName('img').length > 0){
		//	toremove = tables[1];
		//}
		
		toremove.parentNode.removeChild(toremove);
    return this;				
	},
	
	removeAllTablePadding: function(){
		var allTables = document.getElementsByTagName('table');
		var nTables = allTables.length;
		for(var i = 0; i < nTables; i++){
			allTables[i].setAttribute('cellpadding', '0');
			allTables[i].setAttribute('cellspacing', '0');
		}
		return this;
	},
	
	fixSelectBox: function(parentEl){
		if (typeof(jQuery) == 'undefined') {
		  alert('fixSelectBox function requires jquery');
		  return false;
		}
		
		if (window.attachEvent) {
			if($(parentEl + ' select').length > 0){
			  $(parentEl + ' select')
			    .bind('focus mouseover', function() { $(this).addClass('expand').removeClass('clicked'); })
			    .bind('click', function() { $(this).toggleClass('clicked'); })
			    .bind('mouseout', function() { if (!$(this).hasClass('clicked')) { $(this).removeClass('expand'); }})
			    .bind('blur', function() { $(this).removeClass('expand clicked'); });
			}
		}
	},
	
  injectTag: function(options){
    var defaultSettings = {
      "type":null,
      "url":null,
      "callback":null,
      "node":"script",
      "cache":true
  	};
	  for(var i in defaultSettings) {
	    if(typeof options[i] == 'undefined') { options[i] = defaultSettings[i]; }
	  }
  	var parentOfNode = document.getElementsByTagName(options.node)[0];
  	if(options.type == 'stylesheet') {
      var docHead = parentOfNode.parentNode;
      if (document.createStyleSheet) {
        document.createStyleSheet(options["url"]);
        return this;
      } 
      else {
        cssTag = document.createElement('link');
        cssTag.setAttribute('rel', 'stylesheet');
        cssTag.setAttribute('type', 'text/css');
        cssTag.setAttribute('href', options["url"]);
        docHead.appendChild(cssTag);
        return this;
      }      
    } 
    else if(options.type == 'script') {
      var script = document.createElement('script');
      script.type = 'text/javascript';
      ts = new Date().getTime();
      if (script.readyState) {
          script.onreadystatechange = function(){
              if (script.readyState == 'loaded' || script.readyState == 'complete') {
                  script.onreadystatechange = null;
                  if(typeof options.callback == 'function') {
                      options.callback();
                  }
              }
          };
      }
      else {
      	script.onload = function(){
        	if(typeof options.callback == 'function') {
          	options.callback();
          }
        };
      }
      if(options.cache == false) {
      	options.url += (/\?/.test(options.url) ? '&' : '?') + 'vjsNoCache=' + ts;
      }
      script.src = options.url;
      parentOfNode.parentNode.insertBefore(script,parentOfNode);
  	}
	},
  
	checkPage: function(targetPage) {
		if(typeof PageName == 'function') {
			if (PageName().split('#')[0] == targetPage.toLowerCase()) {
				return true;
			} 
			else {
				if(targetPage.toLowerCase() == 'default.asp') {
					if(PageName().split('#')[0] == '') {
						return true;
					}
					return false;
				}
			}
		}
	}	
	
	
}
