<!--
function openWinPopUp(URL,w,h,t,l) {
	var day = new Date();
	var id = day.getTime();
	var wdh = ( w == null || w == "" || w == "undefined" ) ? 250 : w;
	var hgh = ( h == null || h == "" || h == "undefined") ? 160 : h;
	var tp = ( t == null || t == "" || t == "undefined") ? 200 : t;
	var lft = ( l == null || l == "" || l == "undefined") ? 100 : l;
	eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,copyhistory=no, width=" + wdh + ", height=" + hgh + ", left =" + lft + ", top = " + tp + "');");
}

function openPFWinPopUp(URL,w,h,t,l) {

	var wdh = ( w == null || w == "" || w == "undefined" ) ? 250 : w;
	var hgh = ( h == null || h == "" || h == "undefined") ? 160 : h;
	var tp = ( t == null || t == "" || t == "undefined") ? 200 : t;
	var lft = ( l == null || l == "" || l == "undefined") ? 100 : l;
	prnfrdlyPopUpWin = window.open(URL, 'PRINTERFRIENDLY', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no, width=" + wdh + ", height=" + hgh + ", left =" + lft + ", top = " + tp + "');
	return prnfrdlyPopUpWin;
}

function openSmallWinPopUp(URL,w,h,t,l) {
	var wdh = ( w == null || w == "" || w == "undefined" ) ? 250 : w;
	var hgh = ( h == null || h == "" || h == "undefined") ? 160 : h;
	var tp = ( t == null || t == "" || t == "undefined") ? 200 : t;
	var lft = ( l == null || l == "" || l == "undefined") ? 100 : l;
	eval("smallPopUpWin = window.open(URL, 'PRINTERFRIENDLY', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no, width=" + wdh + ", height=" + hgh + ", left =" + lft + ", top = " + tp + "');");
}

function NewWinPopUp(URL) {
	eval("PopUpWin = window.open(URL, 'PRINTERFRIENDLY');");
}

function replace(string,text,by) {
// Replaces text with by in string
    var strLength = string.length, txtLength = text.length;
    if ((strLength == 0) || (txtLength == 0)) return string;

    var i = string.indexOf(text);
    if ((!i) && (text != string.substring(0,txtLength))) return string;
    if (i == -1) return string;

    var newstr = string.substring(0,i) + by;

    if (i+txtLength < strLength)
        newstr += replace(string.substring(i+txtLength,strLength),text,by);

    return newstr;
}

function openPopWindow(url, name) {
 popupWin = window.open(url, name, 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,copyhistory=no,width=590,height=480,top=0,left=0')
}


//Function to open pop up window
function openWin(theURL,winName,features) {
  	window.open(theURL,winName,features);
}

function openPopWin(theURL,winName,features) {
	var day = new Date();
	var id = day.getTime();
  	eval("page" + id + " = window.open('" + theURL + "','" + winName + "','" + features + "');");
}

//Function to open preview post window
function OpenPreviewWindow(targetPage, formName){
	
	now = new Date  
	
	//Open the window first 	
   	openWin('','preview','toolbar=0,location=0,status=0,menubar=0,scrollbars=1,resizable=1,width=680,height=400')
   		
   	//Now submit form to the new window
   	formName.action = targetPage + "?ID=" + now.getTime();	
	formName.target = "preview";
	formName.submit();
}

// Function to open in Main window
function openInMainWin(URL) {
	var day = new Date();
	var id = day.getTime();
	var wdh = ( w == null || w == "" || w == "undefined" ) ? 250 : w;
	var hgh = ( h == null || h == "" || h == "undefined") ? 160 : h;
	var tp = ( t == null || t == "" || t == "undefined") ? 200 : t;
	var lft = ( l == null || l == "" || l == "undefined") ? 100 : l;
	eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=yes,location=yes,directories=no,status=no,menubar=yes,scrollbars=yes,resizable=yes,copyhistory=no, width=" + wdh + ", height=" + hgh + ", left =" + lft + ", top = " + tp + "');");
}
//-->


