var cDOM = {
	toggle: {
		topSubDrop: function(a){
			var par = a.parentNode;
			var d = $(par).find('.dropdElmByTpLink');
			$(par.parentNode).find('.dropdElmByTpLink').each(function(el){
				var _self = this;
				if(_self!=d[0]){
					$(this).hide();
				}
			}); //closing all others before
			d.toggle();
			
			$(par).bind("click", function(e) {
				//do nothing
				var _self = d;
				e.stopPropagation();
				$(document).one('click',function(e){$(_self).hide();});
			});
		},
		
		searchOpsBoundary: function(trigger,scope){
			var par = trigger.parentNode;
			$(trigger).find('.obhSqrSt_Btn>div').toggle();
			var scopedInput = $(par).find('input[name='+scope+']');
			if(scopedInput.val()=='false'){
				scopedInput.val('true');
			}else{
				scopedInput.val('false');
			}
		}
	},
	
	url: {
		_autoInc: 0,
		openWindow: function(url,w,h,forceNew){
			var windwName	=	'sdvw';
			if(forceNew==true){
				this._autoInc++;
				windwName = windwName+'_'+this._autoInc;
			}
			
			if(w==0 || w==undefined){
				var w = 400;
			}
			
			if(h==0 || h==undefined){
				var h = 400;
			}
			
			window.open(url, windwName, 'width='+w+',height='+h+',status=yes,scrollbars=yes,resizable=yes');
			return false;
		}
	},
	
	setTitle: function(title){
		title = title.replace(/\&quot;/gi,'"').replace(/\&amp;/gi,'&');
		document.title = title;
	},
	
	fx: {
		Mouse: {
			i: false,
			x: 0,
			y: 0,
			_e: function(){
				if(!this.i){
					$().mousemove( function(e) {
						cDOM.fx.Mouse.x = e.pageX;
						cDOM.fx.Mouse.y = e.pageY;
					});
					
					this.i=true;
				}
			}
		},
		
		StatusPhraser: {
			id: 'statusPhraser',
			bubble: function(tx,enlarge){
				$('#'+this.id).remove();
				if(!enlarge){
					var elm = $('<div id="'+this.id+'" style="width:100%"><div>'+tx+'</div></div>');
				}else{
					var elm = $('<div id="'+this.id+'" style="width:100%"><div style="width:300px; font-size:13px">'+tx+'</div></div>');
				}
				$('body').append(elm);
				
				elm.show(1,function(){
					var _self = $(this);
					window.setTimeout(function(){
						_self.fadeOut('fast',function(){
							$(this).remove();
						});
					},1850);
				});
				
			},
			hideBubble: function(){
				$('#'+this.id).remove();
			}
		},
		
		underErrorElm: {
			id: 'error_notPlayable',
			show: function(){
				var elm = $('#'+this.id);
				var inner = elm.html().replace(/\<\!--/gi,'').replace(/--\>/gi,'');
				elm.html(inner);
				elm.show();
			},
			hide: function(){
				$('#'+this.id).hide();
			}
		}
	}
};
