// SourceCMS App JScript source code
var appid="/source4cms/"
browserType=navigator.appName;

function createClassFile(idi,vidi)
{
	if (idi!='')
	{
		if (confirm("Stil dosyası güncellenecektir. Devam etmek istiyormusunuz?"))
		{
			document.location.href='?ftur=upd&gtur=form&id='+vidi+'&createfile='+idi
		}
	}
}
function createScriptFile(idi,vidi)
{
	if (idi!='')
	{
		if (confirm("Javascript dosyası güncellenecektir. Devam etmek istiyormusunuz?"))
		{
			document.location.href='?ftur=upd&gtur=form&id='+vidi+'&createfile='+idi
		}
	}
}

function putInTextarea(cnt,val)
{ 
	myValue = ''; 
	if (val == ''){ 
		} else { 
			insertAtcursor(cnt,val); 
				} 
} 

function insertAtcursor(cnt,myValue) { 
	myField = document.forms(0).item(cnt); 
	
	if (document.selection) { 
		myField.focus(); 
		sel = document.selection.createRange(); 
		sel.text = myValue; 
		} 
	document.forms(0).item(cnt).focus(); 
}
function putTabInTextArea(cnt)
{

	if(event.keyCode=='20')
	{
		putInTextarea(cnt,'	')
	}	
	
}

function cms4Navigate(pid,targetpage,target,wid,hgt)
{
	if (target=='1')
	{
		window.open(targetpage,pid,'status=yes,toolbars=no,resizable=yes,scrolling=yes,width='+wid+',height='+hgt)
	}else
		{
			document.location.href=targetpage
		}
}
function viewStylePop(classcode,app,idx)
{
	window.open('/source.net/index.snet?app='+app+'&classcode='+classcode,idx,'statusbar=no,tollbars=no,resizable=yes,width=770,height=400,')
}
function cms4Page(app,ws)
{
	window.open('/source.cms4/index.snet?wslt='+ws+'&wapp='+app,"cms4Page",'scrollbars=yes,statusbar=true,tollbars=true,resizable=yes,width=800,height=600')
}
function showHidePageBlock()
{
	if (document.all.pageBlockMain.style['display']=="none")
	{
			document.all.pageBlockMain.style['display']="inline"
			document.images('pageBlockImage').src='/source.net/solutions/source4cms/images/icons/ezupdate/leftok.gif'
	}else
		{
			document.images('pageBlockImage').src='/source.net/solutions/source4cms/images/icons/ezupdate/rightok.gif'
			document.all.pageBlockMain.style['display']="none"
		}
}
function cms4PollSubmit(frm,mes,pollcode)
{
	if (document.all.item(frm+'hdn').value!='')
	{
		if (mes!='')
		{
			alert(mes);
			document.forms[frm].submit();
		}else
			{
			document.forms[frm].submit();
			}
	}else
	{
		alert("Lütfen seçminizi yapınız...")
	}
	
}
function cms4PreviewData(a)
{
		if (a=='')
		{
				alert("SQL sorgu cümlesini yazınız ve veriyi güncelledikten sonra önizleme yapınız...")
		}else
			{
				if (confirm("SQL çıktısını görüntülemek istediğinizden emin misiniz?"))
				{
					window.open('solutions/source4cms/codefiles/datapreview.snet?tipi=xml',"cms4DataPreviewXML",'scrollbars=yes,statusbar=true,tollbars=true,resizable=yes,top=0,left=0,width=800,height=600')
					window.open('solutions/source4cms/codefiles/datapreview.snet?tipi=sql',"cms4DataPreviewSQL",'scrollbars=yes,statusbar=true,tollbars=true,resizable=yes,top=0,left=0,width=800,height=100')
				}
			}
}
function forumAddAnswer()
{
	document.location.href="?fview=11"
}
function forumAddMessage()
{
	document.location.href="?fview=10"
}
function viewCMSPagePop(wb,pg)
{
	window.open('/source.cms4/index.snet?wslt='+wb+'&wapp='+pg,"cmspagepop",'scrollbars=yes,statusbar=true,tollbars=true,resizable=yes,top=0,left=0,width=800,height=600')
}

function switchdevframe(idcx,a,b)
{
	if (document.all.item(idcx).className==a)
	{
		document.all.item(idcx).className=b
		cms4devframeselect(idcx,'selectedframes','0')
		cms4devframeselect(idcx,'unselectedframes','1')
	}else if (document.all.item(idcx).className==b)
	{
		document.all.item(idcx).className=a
		cms4devframeselect(idcx,'selectedframes','1')
		cms4devframeselect(idcx,'unselectedframes','0')
	}
	//alert(document.all.selectedframes.value)
}

function cms4devframeselect(idx,fld,chk)
{
    if (chk==0)
    {
			
		var vls=document.all.item(fld).value
		vls=vls.replace(idx+',','')
		vls=vls.replace(idx+',','')
		vls=vls.replace(idx+',','')
		vls=vls.replace(idx+',','')
		document.all.item(fld).value=vls+idx+','
	}
	else
	{
		var vls=document.all.item(fld).value
		vls=vls.replace(idx+',','')
		vls=vls.replace(idx+',','')
		vls=vls.replace(idx+',','')
		vls=vls.replace(idx+',','')
		document.all.item(fld).value=vls
	
	}
}
function devselectcol(idc)
{
	if (confirm("[" + idc + "] numaralı bölümlerin tamamını seçmek/bırakmak istiyor musunuz?"))
	{
		var c=0
		pgcoll=document.all.pagecollection.value
		pgcollarr=pgcoll.split(',')
		for (var i=0;i<pgcollarr.length;i++)
			{
			if (c==0){c=1}
			else{c=0}
			switchdevframe(pgcollarr[i]+'_'+idc,'drow'+c,'drow'+c+'z')
			}
	}

}