function FxPop2(url,imgpath,post,pw,ph,pb,pbc,modal)
{
/*  2010.07.09 by Catalin Banici
	url     = the url that the iframe will request;
	imgpath = image path for the cloase button
	post    = if true it doesn't request the url and expects a posting action from the parents form
	pw		= popup width
	ph		= popup height
	pb		= popup border width
	pbc		= popup border color
	modal	= if true then the popup would not close only from a function inside the iframe // else just click outside the popup
*/
	var Pwidth  = 530 ;
	var Pheight = 180 ;
	var PBwidth = 0 ;
	var PBcolor = '#333333' ;
	var Pmodal  = false ;

	if(pw)  {Pwidth  = pw;}
	if(ph)  {Pheight = ph;}
	if(pb)  {PBwidth = pw;}
	if(pbc) {PBcolor = pbc;}

	if(modal) {Pmodal = true;}

	var Ptop  = (Pheight/2) + PBwidth ;
	var Pleft = (Pwidth/2)  + PBwidth ;

	if(post===undefined || post===''){post = false;}
	if(post==='true' || post==='TRUE'){post = true;}

	if(!imgpath){imgpath="aa/imgframe/close_pop_image.jpg";}
	if(!url){url='http://www.google.com';}

	/* define css for the cover and popup */
	var _cnt_css = '.cbody{margin: 0px; padding:0px;color : #333;background-color: #FFF;font-family: Arial, Helvetica, sans-serif;font-size: 12px;}';
		_cnt_css+= '.bfreeze{overflow:hidden;} .dn {display:none;}';
		_cnt_css+= '.det_cnt{position:fixed;top:50%;left:50%;width:0px;height:0px; overflow:visible;}.details{position:absolute;';
		_cnt_css+= 'top:-'+Ptop+'px;left:-'+Pleft+'px;width:'+Pwidth+'px;height:'+Pheight+'px;border:'+PBwidth+'px solid '+PBcolor+'; background-color:#FFFFFF;}';
		_cnt_css+= '.cover{position:fixed;top:0px;left:0px;width:100%;height:100%;background-color:#000000;z-index:0; opacity:0.6;filter:alpha(opacity=60); '
		_cnt_css+= (Pmodal==true?'':'cursor:pointer;')+'}.close{z-index:99;position:absolute;';
		_cnt_css+= 'top:-'+(Ptop-PBwidth)+'px; left:'+(Pleft-32-PBwidth)+'px; width:32px; height:32px; background: url("'+ imgpath +'") ';
		_cnt_css+= 'no-repeat;'+(Pmodal==true?'':'cursor:pointer;')+'}';

	/* insert css into html */

	var addCSS = document.createElement('style');
		addCSS.setAttribute('type','text/css');

	if (addCSS.styleSheet) {
		addCSS.styleSheet.cssText = _cnt_css
	} else {
		addCSS.appendChild(document.createTextNode(_cnt_css))
	}
	document.getElementsByTagName('head')[0].appendChild(addCSS);
	
	/* add div cover and details */
	var d1 = document.createElement('div');
	d1.setAttribute('id','cover');
	d1.setAttribute('class','cover');
	if(Pmodal==false) {
		d1.onclick = function(){FxUnPop();} }
	document.getElementsByTagName('body')[0].appendChild(d1);
//	$("#cover").fadeIn('fast');

	var d2 = document.createElement('div');
	d2.setAttribute('id','det_cnt');
	d2.setAttribute('class','det_cnt');
	document.getElementsByTagName('body')[0].appendChild(d2);

	if(Pmodal==false) {
		var dc = document.createElement('div');
		dc.setAttribute('id','closeBTN');
		dc.setAttribute('class','close');
		dc.onclick = function(){FxUnPop();}
		document.getElementById('det_cnt').appendChild(dc);
	}

	var d3 = document.createElement('div');
	d3.setAttribute('id','details');
	d3.setAttribute('class','details');
	document.getElementById('det_cnt').appendChild(d3);

	var d4 = document.createElement('iframe');
	d4.setAttribute('width','100%');
	d4.setAttribute('height','100%');
	d4.setAttribute('name','detframe');
	d4.setAttribute('frameborder','0');
	d4.setAttribute('scrolling','no');

	if(post===false){ // no posting
		d4.setAttribute('src',url);
		document.getElementById('details').appendChild(d4);
	} 
	if(post===true){  // posting
		d4.setAttribute('src','');
		document.getElementById('details').appendChild(d4);
	}
}

function FxUnPop()
{
/*	
	$("#det_cnt").fadeOut('fast',function(){document.getElementById('det_cnt').parentNode.removeChild(document.getElementById('det_cnt'));});
	$("#cover").fadeOut('fast',function(){document.getElementById('cover').parentNode.removeChild(document.getElementById('cover'));});
*/	
	document.getElementById('det_cnt').parentNode.removeChild(document.getElementById('det_cnt'));
	document.getElementById('cover').parentNode.removeChild(document.getElementById('cover'));
}
