function OpenOrderForm(page , web ) 
   {
        if(page == undefined || page =='' || web == undefined || web == '')
        {
            //post=current_posting;
            return;
        }   
        parameters = '&pageGuid=' + page + '&webGuid=' + web ;
      //OpenModalWindow(https_enabled,true,site_prefix,'/SystemFiles/FormOrder.aspx',post,my_lang,'450','400',null)
      OpenModalWindow(false,true,'SystemFiles/Forms/FormOrder.aspx',parameters,'480','300',null)
   }
   
   function OpenForm(form , lang , type ) 
   {
        if(form == undefined || form =='')
        {
            //post=current_posting;
            return;
        }   
        parameters = '&lang=' + lang  + '&rtype=' + type ;
      //OpenModalWindow(https_enabled,true,site_prefix,'/SystemFiles/FormOrder.aspx',post,my_lang,'450','400',null)
        page_name = 'SystemFiles/Forms/' + form
        height = "600"
        width = "450"
        if (type == '2') //general questions
            height = "500"
        if (type == '1' || type == '4' ) //pniot questions
            height = "560"
        if (lang == 'ru-RU') //russian
        {
            height = "620"
            width = "590"
        }
        OpenModalWindow(false, true, page_name, parameters, width, height, null)
   }
   
   function OpenPublicationOrder(page , web)
   {
        if(page == undefined || page =='' || web == undefined || web == '')
        {
            //post=current_posting;
            return;
        }   
           
    parameters = '&pageGuid=' + page + '&webGuid=' + web ;
    OpenModalWindow(false,true,'SystemFiles/Forms/PublicationOrder.aspx',parameters,'470','400',null)
   }
   
   function OpenModalWindow(https_enabled,is_https,page_name,parameters,width,height,arg_array)
   {
   var prefix = "";

   if (location.hostname.toLowerCase() == "www.btl.gov.il" || location.hostname.toLowerCase() == "www2.btl.gov.il") {
       prefix = "https://" + location.hostname;
   }
   
   
   //(is_https==true && https_enabled==true ?'https://':'http://') + site_prefix ;
  
    var dialog_path =prefix+'/SystemFiles/Dialog_Matefet.aspx';
//    if(is_https==true && https_enabled==true)
//        dialog_path =prefix+ '/Dialog_ssl.aspx';
    
    var path =prefix +'/'+ page_name + parameters;
//    if(current_posting !='' && current_posting !=undefined)
//         path =path +'&current_posting='+current_posting
//    if(my_lang !='')
//	     path =path+'&lang='+my_lang 
	     
	if(document.all)    //IE
	
	    var retVal=window.showModalDialog(dialog_path +'?path='+ path,arg_array,'dialogHeight:'+height+'px; dialogWidth:'+width+'px;  edge: Raised; center: yes; help: No; resizable: yes; scroll: No; status: No;location:no')
	
	else             //firefox
	
	   window.open(dialog_path +'?path='+ path,arg_array, 'height='+height+'px,width='+width+'px,directories=no,location=no,menubar=no,status=no,toolbar=no ,center=yes')
	
}

 function CloseWindow()
 {
    parent.window.close();
}
function replaceQueryString(keyParam, valueParam, OrginalUrl) {
    //debugger;

    var ReturnValue = '?';
    var query = '';

    var OrginalUrlAray = OrginalUrl.split('?');

    if (OrginalUrlAray.length == 2) {
        query = OrginalUrlAray[1];
    }

    ReturnValue = OrginalUrlAray[0] + '?';

    var parms = query.split('&');
    var HasUpdate = false;

    for (var i = 0; i < parms.length; i++) {

        var param = parms[i].split('=');

        if (param.length == 2) {
            if (param[0].toLowerCase() == keyParam.toLowerCase()) {
                param[1] = valueParam;
                HasUpdate = true;
            }
            ReturnValue += param[0] + '=' + param[1] + '&';
        }
    }

    if (HasUpdate == false) {
        ReturnValue += keyParam + '=' + valueParam + '&';
    }

    return ReturnValue.substring(0, ReturnValue.length - 1);
} 
//function OpenModalWindow(https_enabled,is_https,site_prefix,page_name,current_posting,my_lang,width,height,arg_array){
//   var prefix = (is_https==true && https_enabled==true ?'https://':'http://') + site_prefix ;
//  
//    var dialog_path =prefix+'/Dialog_Matefet.aspx';
//    if(is_https==true && https_enabled==true)
//        dialog_path =prefix+ '/Dialog_ssl.aspx';
//    
//    var path =prefix +'/'+ page_name;
//    if(current_posting !='' && current_posting !=undefined)
//         path =path +'&current_posting='+current_posting
//    if(my_lang !='')
//	     path =path+'&lang='+my_lang 
//	     
//	if(document.all)    //IE
//	
//	    var retVal=window.showModalDialog(dialog_path +'?path='+ path,arg_array,'dialogHeight:'+height+'px; dialogWidth:'+width+'px;  edge: Raised; center: yes; help: No; resizable: no; scroll: Auto; status: No;location:no')
//	
//	else             //firefox
//	
//	   window.open(dialog_path +'?path='+ path,arg_array, 'height='+height+'px,width='+width+'px,directories=no,location=no,menubar=no,status=no,toolbar=no ,center=yes')
//	
//}

