
function View(form,txt) {
msg=open("","DisplayWindow","width=500,height=300,status=1,scrollbars=1");
msg.document.write("<html><head>");
msg.document.write("<title>CMS Admin - Text preview </title>");
msg.document.write("<link rel=\"stylesheet\" href=\"css/mystyle.css\" type=\"text/css\">");
msg.document.write("<style>");
msg.document.write(" p {  text-align: justify} ")
msg.document.write("</style>");
msg.document.write("</head><body >");
msg.document.write("<table border=0><tr><td >");
msg.document.write("<p>");
msg.document.write(txt.value);
msg.document.write("</td></tr></table>");
msg.document.write("</body></html>");
}

function ViewTiny(form,txt) {
msg=open("","DisplayWindow","width=500,height=300,status=1,scrollbars=1");
msg.document.write("<html><head>");
msg.document.write("<title>CMS Admin - Text preview </title>");
msg.document.write("<link rel=\"stylesheet\" href=\"css/mystyle.css\" type=\"text/css\">");
msg.document.write("<style>");
msg.document.write(" p {  text-align: justify} ")
msg.document.write("</style>");
msg.document.write("</head><body >");
msg.document.write("<table border=1 cellpadding=0 cellspacing=0 width=\"162\"><tr><td >");
msg.document.write(txt.value);
msg.document.write("</td></tr></table>");
msg.document.write("</body></html>");
}


function AddText(form, Action, txtelem){
var AddTxt="";
var txt="";
if(Action==1){
txt=prompt("Enter text for HEADER1.","Text");
if(txt!=null)
AddTxt="<h1>"+txt+"</h1>\r\n";
}
if(Action==2){
txt=prompt("Enter text for HEADER2.","Text");
if(txt!=null)
AddTxt="<h2>"+txt+"</h2>\r\n";
}
if(Action==3) AddTxt="&nbsp;";
if(Action==4) {
txt=prompt("Enter text for BOLD","Text");
if(txt!=null)
AddTxt="<b>"+txt+"</b>";
}
if(Action==5) {
txt=prompt("Enter text for ITALIC","Text");
if(txt!=null)
AddTxt="<i>"+txt+"</i>";
}
if(Action==6) AddTxt="\r\n<p>";
if(Action==7) AddTxt="<BR>\r\n";
if(Action==8) AddTxt="<hr>\r\n";
if(Action==9) {
txt=prompt("URL for link","http://");
if(txt!=null){
AddTxt="<a href="+txt+">";
txt=prompt("Text for link","Text");
AddTxt+=txt+"</a>\r\n";
   }
}
if(Action==10) {
txt=prompt("Image URL","URL");
if(txt!=null)
AddTxt="<img src="+txt+">\r\n";
}

txtelem.value+=AddTxt;
}

function OpenWin(address) {
	var op_tool  =  0;
	var op_loc_box  =  0;
	var op_dir  =  0;
	var op_stat  =  0;
	var op_menu  =  0;
	var op_scroll  =  0;
	var op_resize  =  0;
	var op_wid  = 360;
	var op_heigh = 280;
	var option = "toolbar="+ op_tool +",location="+ op_loc_box +",directories="
+ op_dir +",status="+ op_stat +",menubar="+ op_menu +",scrollbars="
+ op_scroll +",resizable="  + op_resize +",width=" + op_wid +",height="+ op_heigh +",left=100,top=100";
	var win3 = window.open("", "what_I_want", option);
	var win4 = window.open(address, "what_I_want");
}

function SettingsPassText1(valoare) {
  document.forms[0].s_img1.value = valoare;
  //alert(document.forms[0].pf_img.value + "[[[" + valoare);
}

function SettingsPassText2(valoare) {
  document.forms[0].s_img2.value = valoare;
}

function SettingsPassText3(valoare) {
  document.forms[0].s_img3.value = valoare;
}

function SettingsPassText4(valoare) {
  document.forms[0].s_img4.value = valoare;
}

function SettingsPassText5(valoare) {
  document.forms[0].s_img5.value = valoare;
}

function SettingsPassText6(valoare) {
  document.forms[0].s_img6.value = valoare;
}

function SettingsPassText7(valoare) {
  document.forms[0].s_img7.value = valoare;
}


function PagesPassText1(valoare) {
  document.forms[0].p_img1.value = valoare;
}

function PagesPassText2(valoare) {
  document.forms[0].p_img2.value = valoare;
}

function PagesPassText3(valoare) {
  document.forms[0].p_img3.value = valoare;
}

function PagesPassText4(valoare) {
  document.forms[0].p_img4.value = valoare;
}

function ItemsPassText1(valoare) {
  document.forms[0].i_img1.value = valoare;
}

function usure ( message, url ) {
	arethey = confirm(message)
	if (arethey) {location.href=url}
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_validateForm() { //v4.0
  var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
  for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=MM_findObj(args[i]);
    if (val) { nm=val.name; if ((val=val.value)!="") {
      if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
        if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.\n';
      } else if (test!='R') {
        if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';
        if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
          min=test.substring(8,p); max=test.substring(p+1);
          if (val<min || max<val) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
    } } } else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.\n'; }
  } if (errors) alert('The following error(s) occurred:\n'+errors);
  document.MM_returnValue = (errors == '');
}

function ShowDate1() {
var mydate=new Date()
var year=mydate.getYear()
var daym=mydate.getDate()
var month=mydate.getMonth()
if (daym<10)
daym="0"+daym
var montharray=new
Array('January','Februari','Maart','April','Mei','Juni','Juli','Augustus', 'September','Oktober','November','December')
document.write(" "+montharray[month]+" "+daym+"th, "+year+" ")
}


function ShowDate2 () {
var mydate=new Date()
var year=mydate.getFullYear()
var day=mydate.getDay()
var month=mydate.getMonth()
var daym=mydate.getDate()
var dayarray=new Array("Zondag","Maandag","Dinsdag","Woensdag","Donderdag", "Vrijdag","Zaterdag")
var montharray=new Array("Januari","Februari","Maart","April","Mei","Juni"
,"Juli","Augustus","September","Oktober","November","December")
document.write(dayarray[day]+", "+montharray[month]+" "+daym+"th, "+year)
}


/***************************************
	Required Functions
***************************************/
function modalDialogShow_IE(url,width,height) //IE
	{
	return window.showModalDialog(url,window,
		"dialogWidth:"+width+"px;dialogHeight:"+height+"px;edge:Raised;center:Yes;help:Yes;Resizable:Yes;Maximize:Yes");
	}
function modalDialogShow_Moz(url,width,height) //Moz
    {
    var left = screen.availWidth/2 - width/2;
    var top = screen.availHeight/2 - height/2;
    activeModalWin = window.open(url, "", "width="+width+"px,height="+height+",left="+left+",top="+top);
    window.onfocus = function(){if (activeModalWin.closed == false){activeModalWin.focus();};};
    }
var sActiveAssetInput;
var sActiveAssetWindow;
function setAssetValue(v) //required by the asset manager
    {
    sActiveAssetWindow.document.getElementById(sActiveAssetInput).value = v;
    }
function openAsset(s,w)
	{
	sActiveAssetInput = s;
  sActiveAssetWindow = w ? w : window;
	if(navigator.appName.indexOf('Microsoft')!=-1)
		sActiveAssetWindow.document.getElementById(s).value=modalDialogShow_IE("editor/assetmanager/assetmanager.php?lang=nl-NL",720,620); //IE
	else
		modalDialogShow_Moz("editor/assetmanager/assetmanager.php?lang=nl-NL",720,620); //Moz
	}
/*****************************************/