var browserName=navigator.appName;
var formName = "parm";

function pageUpdater(container, actionFile, action, extra, flag)
{
    var d = new Date();
    var timex = d.getTime();

    var params = '&nocaching=' + timex;
	
    var myAjax = new Ajax.Updater(
                {success: container},
                actionFile,
                {
                    method: 'post',
                    parameters: params,
                    evalScripts: true
                });
}
function topicUpdater(container, actionFile, topic, cmd, postId)
{
    var d = new Date();
    var timex = d.getTime();

	if (document.getElementById('post') != null) {
		post = document.getElementById('post').value;
		var params = 'topicForumId=' + topic + '&actionCmd=' + cmd + '&action=' + cmd + '&post=' + post + '&postId=' + postId + '&nocaching=' + timex;
	} else {
		var params = 'topicForumId=' + topic + '&action=' + cmd + '&nocaching=' + timex;	
	}
    
	
    var myAjax = new Ajax.Updater(
                {success: container},
                actionFile,
                {
                    method: 'post',
                    parameters: params,
                    evalScripts: true
                });
}
function forumUpdater(container, actionFile, category)
{
    var d = new Date();
    var timex = d.getTime();
	var params = 'categoryId=' + category + '&nocaching=' + timex;	

    var myAjax = new Ajax.Updater(
                {success: container},
                actionFile,
                {
                    method: 'post',
                    parameters: params,
                    evalScripts: true
                });
}

function formUpdater(formName, container, actionFile, action, extra, flag)
{
    var d = new Date();
    var timex = d.getTime();

    var formParams = Form.serialize(formName);
    var params = 'flag=' + flag + '&extra=' + extra + '&action=' + action + '&' + formParams + '&nocaching=' + timex;
	
    var myAjax = new Ajax.Updater(
                {success: container},
                actionFile,
                {
                    method: 'post',
                    parameters: params,
                    evalScripts: true
                });
}

function dataSearchPagination(z, file, formName)
{
	var x = document.getElementById(formName);
	x.searchPage.value=z;
	formUpdater(formName,'mainbody', file + '?axn=save');
}

function dataSearchOrderBy(z,y,e, file, formName)
{
	var x = document.getElementById(formName);
	x.orderPage.value=z;
	x.searchPage.value=y;
	x.isdescPage.value=e;
	formUpdater(formName,'mainbody', file + '?axn=save');
}

function viewSearchDetails(z)
{
	var x = document.parm;
	setCookie("sdocid",z,"","","","");
	window.open("viewsearchdet.php","viewphoto",'left=20,top=20,width=650,height=650,toolbar=0,resizable=0, scrollbars=1');
	return true;
}

function setCookie( name, value, expires, path, domain, secure ) {
  var today = new Date();
  today.setTime( today.getTime() );
  if ( expires ) {
    expires = expires * 1000 * 60 * 60 * 24;
  }
  var expires_date = new Date( today.getTime() + (expires) );
  document.cookie = name+"="+escape( value ) +
    ( ( expires ) ? ";expires="+expires_date.toGMTString() : "" ) +
//expires.toGMTString()
    ( ( path ) ? ";path=" + path : "" ) +
    ( ( domain ) ? ";domain=" + domain : "" ) +
    ( ( secure ) ? ";secure" : "" );
}