var Dom = {
	//internet explorer detection (true|false)
	ie: function(){
		if(document.all)return 1
		return 0
	},
	
	//scanned html elements array
	tags: ['div','img','span','ul'],
	
	//custom html attribute name for assigned motion behavior
	action: 'hotness',
	
	//include needed JavaScript Files
	getJS: function(){
		var head = document.getElementsByTagName('head')[0]
		for(var i = 0; i < arguments.length; i++) {
			var include = document.createElement('script')
			include.src = arguments[i]
			include.type = "text/javascript"
			head.appendChild(include);
		}
	},
	
	//initiate the api
	father: function(opt){
		if(opt){
			for(i=0; i<opt.length; i++){
				scanElements(opt[i])
			}
		}else{
			scanLayer(document.body)
		}
	},
	
	//run tag against allowed array 
	isAllowed: function(ele){
		for(var i=0; i<Dom.tags.length; i++){
			if(Dom.tags[i] == ele)return true
		}
		return false
	},
	
	//overide parameters
	getParams: function(overide,original){
		for(property in overide){
			//overide parameter
			original[property] = overide[property]
		}
		return original
	}
	
}

var ie = Dom.ie()



/////////////////////////////////// extend OBJECT ///////////////////////////////////////

Dom.getParams(
			  	{
				//JSON object of new paramerters and methods
					
					//return array of 1st child elements
					getChildElements: function(ele){
						//var temp = {}
						//var ele = Dom.getParams(temp,ele)
						if(this.hasChildNodes()){
							var elm = []
							for(var i=0; i<this.childNodes.length; i++ ){
								if(this.childNodes[i].tagName){
									if(ele){
										if(this.childNodes[i].tagName.toLowerCase() == ele) elm.push(this.childNodes[i])
									}else{
										elm.push(this.childNodes[i])
									}
								}
							}
							return elm
						}
						return false
					},
					
					//returns the dems of child elements
					getChildDem: function(){
						var temp = this.getChildElements()
						var h = 0
						var w = 0
						for(var i=0; i<temp.length; i++){
							h += parseInt(temp[i].offsetHeight)
							w += parseInt(temp[i].offsetWidth)
						}
						return {height:h,width:w}
					}
				
				//END JSON object
				}
				,
			 //native javascript object to add paramerters to
			 Object.prototype
			 );
			 
			 
function dropNav(obj,para){
	if(ie)obj = Dom.getParams({},obj)
	
	var elm = obj.getChildElements('li')
	for(var i=0; i<elm.length; i++){
		var ele = elm[i]
		//drop it down
		ele.onmouseover = function(){
			var dem = {}
			var temp = this
			
			if(ie)temp = Dom.getParams({},temp);
			var temp2 = null;
			var subLists = temp.getChildElements('ul');
			var maxHeight = 0;
			var totalWidth = 0;  // look into not hardcoding
			var margin = subLists[0].style.marginLeft;
			for(var i=0; i<subLists.length; i++) {
				temp2 = subLists[i];
				if(ie) temp2 = Dom.getParams({},temp2);
				temp2.style.display = "block";
				maxHeight =Math.max(maxHeight,parseInt(temp2.offsetHeight));
				totalWidth = totalWidth+parseInt(temp2.offsetWidth);
			}
			dem.width = totalWidth;
			dem.height = maxHeight;
			
			//create iframe layer
			if(ie){
				if(temp.getChildElements('div').length > 0){
					temp.getChildElements('div')[0].style.display = 'block'
				}else{
					var oDiv = document.createElement('div')
					oDiv.className = "oDiv"
					oDiv.style.display = 'block'
					oDiv.style.height = dem.height+'px'
					oDiv.style.width = dem.width+'px'
					oDiv.innerHTML = "<iframe style='filter:progid:DXImageTransform.Microsoft.Alpha(style=0,opacity=0);' scrolling='no' src='javascript:false;' frameborder='0' height='" +  dem.height + "px' width='" + dem.width + "px'></iframe>"
					temp.insertBefore(oDiv,temp.getChildElements('ul')[0])
				}
			}
		}
		
		//bring it up
		ele.onmouseout = function(){
			var temp = this
			var temp2 = null;
			var subLists = temp.getChildElements('ul');
			if(ie)temp = Dom.getParams({},temp)
			for(var i=0; i<subLists.length; i++) {
				temp2 = subLists[i];
				if(ie) temp2 = Dom.getParams({},temp2);
				temp2.style.display = "none";
			}
			if(ie)temp.getChildElements('div')[0].style.display ="none"
		}
	}
}













