
var aParentValueControl;
var aValueControl;
var aTextControl;
var retvalue = null;	
var test;
			
function fShowPopUp(ctl, link, parent_control_name, currnet_control_name)
{	
	var aValueID = ctl.id.replace('BTN', 'VALUE')
	//alert(aValueID);
	var aTextID = ctl.id.replace('BTN', 'TEXT')
	var aParentValueID = aValueID.replace(currnet_control_name, parent_control_name);
	
	var aParentValue='';

	aParentValueControl = document.getElementById(aParentValueID);
	if(aParentValueControl!==null)
		aParentValue = aParentValueControl.value;	
	
	
	aValueControl = document.getElementById(aValueID);
	aTextControl = document.getElementById(aTextID);
	//
	if (window.navigator.appName.toLowerCase().indexOf('microsoft') > -1) 
	{
		retvalue = window.showModalDialog('container.aspx?' + link + '&parent=' + aParentValue,'','dialogWidth:' + 570 + 'px;dialogHeight:' + 420 + 'px;status:no;help:no;edge:sunken');
		ret();			
	}
	else 
	{
		window.open('PopUp.aspx?' + link + '&parent=' + aParentValue, null, 'height=500,width=600,status=yes,toolbar=no,menubar=no,location=no');
	}
	return false;							
}

function fShowPopUpModeless(ctl, link, parent_control_name, currnet_control_name)
{		
	if (window.navigator.appName.toLowerCase().indexOf('microsoft') > -1) 
	{
		window.showModelessDialog('container.aspx?' + link, window, 'dialogWidth:' + 570 + 'px;dialogHeight:' + 420 + 'px;status:no;help:no;edge:sunken');					
	}
	else 
	{
		window.open('PopUp.aspx?' + link + '&parent=' + aParentValue, null, 'height=500,width=600,status=yes,toolbar=no,menubar=no,location=no');
	}
	return false;							
}
	
function fShowPopUp2(link, height, width)
{
	if (window.navigator.appName.toLowerCase().indexOf('microsoft') > -1) 
	{
		retvalue = window.showModalDialog(link,'','dialogWidth:' + width + 'px;dialogHeight:' + height + 'px;status:no;help:no;edge:sunken');
		ret();			
	}
	else 
	{
		window.open(link, null, 'height=height,width=width,status=yes,toolbar=no,menubar=no,location=no');
	}
	return false;							
}


function Reload()
{
    window.location.reload(true);
}

function Submit()
{
    window.Form1.submit();
}

function ret()	
{						
	if(retvalue!=null)						
	{
		if(retvalue.Action=='reload')
		{							
			window.location.reload(true);								
		}
		else if(retvalue.Action=='submit')
		{
			window.Form1.submit();	
		}
		else
		{												
			aValueControl.value = retvalue.Value;
			aTextControl.value = retvalue.Text;												
		}
	}						
	else
	{
		if(aValueControl!==null)
		{
			aValueControl.value = '';
			aTextControl.value = '';							
		}	
	}					
}					
					
function ShowUploadPictures(wHeight, wWidth)
{         	
	retvalue = window.showModalDialog('UploadFileDialog.aspx','','dialogWidth:' + wWidth + 'px;dialogHeight:' + wHeight + 'px;status:no;');	
	return false;	
}
function ShowUploadPictures2(wHeight, wWidth, path)
{       
	retvalue = window.showModalDialog('UploadFileDialog.aspx?p=' + path,'','dialogWidth:' + wWidth + 'px;dialogHeight:' + wHeight + 'px;status:no;');	
	return false;	
}
function fShowImagesList(ctl, path)
{
	var arr;
	var date = new Date();
	//alert(date.toTimeString());
	
	retvalue = window.showModalDialog('show_image.aspx?p=' + path + '&t=' + date.toTimeString(),'','dialogWidth:' + 500 + 'px;dialogHeight:' + 500 + 'px;status:no;');
	if (retvalue!=null)
	{
		arr=retvalue.split('/');
		document.all[ctl.id.replace('btn', 'VALUE')].value = arr[arr.length-1];
		document.all[ctl.id.replace('btn', 'IMG')].src = retvalue;
		//alert(document.all[ctl.id.replace('btn', 'VALUE')].id);			
	}							
	return false;	
}	
						
function fnSetHomePage(_href)
{
	oHomePage.setHomePage(_href);
	event.returnValue = false;
}
	