//Image & Upload ---------
var fileId = "";

function showImage(myimage)
{
	showModelessDialog('../DialogContainer.aspx?file=image/fullimage.aspx&Id='+myimage, window,'status:no;dialogWidth:640px;dialogHeight:450px;resizable:yes;scroll:yes;');
}

function showQuickImage(myimage)
{
	showModelessDialog('../DialogContainer.aspx?file=image/fullimage.aspx&qId='+myimage, window,'status:no;dialogWidth:640px;dialogHeight:450px;resizable:yes;scroll:yes;');
}

//Nu cred ca e folosita nicaieri // se foloseste de fapt cea din common
function showupload(appid)
{            
	url= ServerVirtualPath + '/ppp/DialogContainer.aspx?file=Upload/Upload.aspx&appid='+appid;	
	window.showModalDialog(url, 'uploadDialog', 'dialogWidth=550px; dialogHeight=525px; resizable=no; help=no; status=no; scrollbars=yes');
	document.forms[0].submit();		
}

function openImageEditor()
{
	url='../DialogContainer.aspx?file=image/editImage.aspx&mode=1';
	window.showModalDialog(url, 'editorDialog', 'dialogWidth=730px; dialogHeight=574px; resizable=no; help=no; status=no; scrollbars=yes');
	document.forms[0].submit();
}
var win = null;
function saveDocument(document)
{
	win = null;
	win = window.open("UploadSavePage.aspx?doc=" + document, 'savewindow','width=100,height=60');
	setTimeout('closeSaveWindow()', 2000);
}
function saveQDocument(document)
{
	win = null;
	win = window.open("UploadSavePage.aspx?qdoc=" + document, 'savewindow','width=100,height=60');
	setTimeout('closeSaveWindow()', 2000);
}
function closeSaveWindow()
{if(win!=null)win.close();
if(win!=null)setTimeout('closeSaveWindow()', 2000);	
}
          
function SubmitPage()
{
	var fileOne = CrossBrowserGetElementById("txtFileContentsI").value;
	var fileTwo = CrossBrowserGetElementById("txtFileContentsII").value;
	var fileThree = CrossBrowserGetElementById("txtFileContentsIII").value;
	var isOk = true;
	if(fileOne.length > 0)
	{
		var strOne = fileOne.substr(fileOne.length-3, fileOne.length);
		if(strOne == "jpg" || strOne  == "gif" || strOne == "bmp" || strOne == "pdf" || strOne == "doc" || strOne == "xls")
			{isOk = true;}
		else
			{isOk = false;}		
	}
	
	if(fileTwo.length > 0 && isOk)
	{
		var strTwo = fileTwo.substr(fileTwo.length-3, fileTwo.length);
		if(strTwo == "jpg" || strTwo  == "gif" || strTwo == "bmp" || strTwo == "pdf" || strTwo == "doc" || strTwo == "xls")
			{isOk = true;}
		else
			{isOk = false;}		
	}	
	
	if(fileThree.length > 0 && isOk)
	{
		var strThree = fileThree.substr(fileThree.length-3, fileThree.length);
		if(strThree == "jpg" || strThree  == "gif" || strThree == "bmp" || strThree == "pdf" || strThree == "doc" || strThree == "xls")
			{isOk = true;}
		else
			{isOk = false;}		
	}	
	
	if(fileOne.length == 0 && fileTwo.length == 0 && fileThree.length == 0)
		{isOk = false;}
		
	if(isOk)
		{
			/*var theform;
			if (window.navigator.appName.toLowerCase().indexOf("microsoft") > -1) {
				theform = document.Form1;
				}
			else {
				theform = document.forms["Form1"];
				}
			
			theform.submit();*/
		}
	else
		{alert("Tipul unuia dintre fisiere nu corespunde cu niciunul dintre tipurile acceptate pentru upload!");}
}