//////////////////////
//  OVER CONTENTS
////////////////////////
var blackFadeDur = 500;
function showBlackPanel(finalval,high){
	finalval = finalval==null?.8:finalval;
	high = high==null?false:true;
	var bp = dojo.byId('blackpanel'+(high?'high':''));
	bp.style.display = 'block';
	fixBlackPanel();
	dojo.animateProperty({
		node: "blackpanel"+(high?'high':''),
		duration:blackFadeDur,
		properties: { opacity: {start:0,end:finalval } }
	}).play();
}
function hideBlackPanel(){
	var bp = dojo.byId('blackpanel');
	var bp2 = dojo.byId('blackpanelhigh');
	//bp.style.display = 'none';
	dojo.animateProperty({
		node: "blackpanel",	duration:blackFadeDur,
		properties: {opacity: {start:bp.style.opacity,end:0 } }}).play();
	dojo.animateProperty({
		node: "blackpanelhigh",	duration:blackFadeDur,
		properties: {opacity: {start:bp2.style.opacity,end:0 } }}).play();
	setTimeout(function(){bp.style.display = 'none';bp2.style.display = 'none';},blackFadeDur);
}
function fixBlackPanel(){
	var bp = dojo.byId('blackpanel');
	var tempstate = bp.style.display;
	bp.style.display = 'none';
	//hideBlackPanel();
	//var pss = getPageSize();
	//bp.style.width = pss[0]+"px";
	//bp.style.height = pss[1]+"px";
	bp.style.height = dojo.byId("main").offsetHeight+"px";
	bp.style.display = tempstate;
	var bph = dojo.byId('blackpanelhigh');
	tempstate = bph.style.display;
	bph.style.display = 'none';
	var pss = getPageSize();
	//bp.style.width = pss[0]+"px";
	bph.style.height = pss[1]+"px";
	bph.style.display = tempstate;
}
function showOverContents(high){
	high = high==null?false:true;
	var oc = dojo.byId('overcontents'+(high?'high':''));
	oc.style.display = 'block';
	fixOverContents(high);
}
function fixOverContents(high){
	var oc = dojo.byId('overcontents'+(high?'high':''));
	//var op = dojo.byId('overpreview');
	var pss = getPageSize();
	//var psc = getPageScroll();
	//var psc = getPageScroll();
	//oc.style.top = (psc[1] + (pss[3] / 10))+"px";
	var owid = getElementWidth("overcontents"+(high?'high':''));
	var npos = (pss[0]/2)-(owid/2);
	oc.style.left = npos+"px";
	var mainph = dojo.byId('mainph');
	mainph.scrollTop = 0;
	//op.style.width = (pss[0]-60)+"px";
}
function closeOverContents(){
	hideBlackPanel();
  	var container = dojo.byId('overcontents');
	container.style.display='none';
	container.innerHTML = "";
  	var container2 = dojo.byId('overcontentshigh');
	container2.style.display='none';
	container2.innerHTML = "";
  	//var previewer = dojo.byId('overpreview');
	//previewer.style.display='none';
	//dojo.byId('previewtitle').innerHTML = "";
	//dojo.byId('previewcode').innerHTML = "";
	//dojo.byId('previewextra').innerHTML = "";
	var bp = dojo.byId('blackpanel');
	bp.onclick=null;
}





function makeOverpreviewerDragable(prevId){
	var previewer = dojo.byId(prevId==null?'overpreview':prevId);
	if(previewer!=null){
		var parts = dojo.query(".corner",previewer).concat(dojo.query(".qpborder",previewer)).concat(dojo.query(".previewtitle",previewer));
		for(var i=0;i<parts.length;i++){
			new dojo.dnd.Moveable(previewer, {handle: parts[i]});
		}
	}
}
