function setSize(){
	var sh,sw,win,scroll;
	sh = screen.height;

	win=getWindowSize();
	scroll=getScrollXY();
	if(scroll.y>10 && win.y+100<sh)	{
		self.resizeTo(win.x,win.y+100);
		setSize();	
	}

	win=getWindowSize();
	scroll=getScrollXY();
	sw = screen.width;
	if(scroll.x>1 && win.x+100<sw)	{
		self.resizeTo(win.x+100,win.y);
		setSize();	
	}
}

function getWindowSize() {
	var myWidth = 0, myHeight = 0;
	if( typeof( window.innerWidth ) == 'number' ) {
		//Non-IE
		myWidth = window.innerWidth;
		myHeight = window.innerHeight;
	} else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
		//IE 6+ in 'standards compliant mode'
		myWidth = document.documentElement.clientWidth;
		myHeight = document.documentElement.clientHeight;
	} else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
		//IE 4 compatible
		myWidth = document.body.clientWidth;
		myHeight = document.body.clientHeight;
	}
		return  {x:myWidth,y: myHeight};
}


function getScrollXY() {
	var scrOfX = 0, scrOfY = 0;
	if(window.scrollMaxX || window.scrollMaxY){
		scrOfX=window.scrollMaxX;	
		scrOfY=window.scrollMaxY;	
	}
	else if( typeof( window.pageYOffset ) == 'number' ) {
		//Netscape compliant
		scrOfY = window.pageYOffset;
		scrOfX = window.pageXOffset;
	} 
	else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {
		//DOM compliant
		scrOfY = document.body.scrollTop;
		scrOfX = document.body.scrollLeft;
	} 
	else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {
		//IE6 standards compliant mode
		scrOfY = document.documentElement.scrollTop;
		scrOfX =
		document.documentElement.scrollLeft;
	}
	return {x :scrOfX,y:scrOfY };
}

function reloadParent(){
	self.opener.location.reload();
}

function focusParent(){
	if(self.opener.focus){
		self.opener.focus();
	}
}

function updateSuccess(){
	reloadParent();
}

function disableDateSel(form, regex_tag_name, status){
	for(var el in form){
		if(el.match(regex_tag_name)==null){continue;}
		form[el].disabled=status;
	}
}

function cms_delete(form){
	if(form && form.del_action && form.del_action.value=='delete'){
		var el;
		var a_el;
		for(var i=0; i<form.length;i++){
			el=form.elements[i];
			if(el.type!='checkbox' || el.name.substr(0,3)!='qf-') {continue;}
			a_el = el.name.split('-');
			oUrl.setVar('cms','delete');
			oUrl.setVar('mod',a_el[1])
			oUrl.setVar('id',a_el[3]);
			alert(oUrl.getUrl());
			newAdminWin(oUrl.getUrl(), a_el[1]);
			//document.location=oUrl.getUrl());
			return true;
		}
			
		return false;
	}
	return true;
}

/*
********** CODE ****************

if(self.focus){
	self.focus();
	//alert('focus');
}
else{
	alert('NO focus');
}

*/
oOnload.addEvent('setSize()');
