/***************************************************
 file contains javascript functions 
****************************************************/
var qoutes_char;
qoutes_char='"';
window.status='';


/**********************************************************************
 functions check_data 
 **********************************************************************/

function check_data(st,min_value,max_value)
{
var i,ch,j,z;	var checkOK = "0123456789";	var checkStr = st; var allValid = true;
z=0;
for (i = 0;  i < checkStr.length;  i++)
		{
		 ch = checkStr.charAt(i);
		 for (j = 0;  j < checkOK.length;  j++)	
			 if (ch == checkOK.charAt(j))
				break;
		  if (j == checkOK.length)
			{
			allValid = false;break;
			}
		}
if (!allValid ) {z=1}
if (st<min_value-1) {z=1}
if (st>max_value) {z=1}
return z
}

/**********************************************************************
 functions  check_date
 **********************************************************************/
	
function check_date(date_format,input_name)
{	
var ok_flag,i,run_this;
var mm,dd,yy,hour,min,sec;
if ( eval("document."+input_name+".value.length") == 19) 
{
	 if (date_format==1)
		{
		dd = eval("document."+input_name+".value.slice(0,2)");
		mm = eval("document."+input_name+".value.slice(3,5)");
		}
		else
		{
		mm = eval("document."+input_name+".value.slice(0,2)");
		dd = eval("document."+input_name+".value.slice(3,5)");
		}
		yy = eval("document."+input_name+".value.slice(6,10)");
		hour = eval("document."+input_name+".value.slice(11,13)");
		min = eval("document."+input_name+".value.slice(14,16)");
		sec = eval("document."+input_name+".value.slice(17,19)");
		if (check_data(mm,1,12) + check_data(dd,1,31) + check_data(yy,1951,2037) + check_data(hour,00,24) + check_data(min,00,59)+ check_data(sec,00,59) >0)
		{
		eval("document."+input_name+".focus();")
		}
		}
else
{
eval("document."+input_name+".focus();")
}
};

/**********************************************************************
 functions  add_to
 **********************************************************************/
function add_to(inputname,unit,max,min,action)
{
 var inp_str,delta;
 var obj=eval('document.'+inputname);
	 if ((unit.toString().indexOf(".") > 0) && (obj.value.indexOf(".") < 0))
		inp_str = unit.toString();
	 else if((unit.toString().indexOf(".") < 0) && (obj.value.indexOf(".") > 0))
		inp_str = obj.value;
	 else if((unit.toString().indexOf(".") < 0) && (obj.value.indexOf(".") < 0))
		inp_str = obj.value;
	 else if ((unit.toString().length - unit.toString().indexOf(".")) > (obj.value.length - obj.value.indexOf("."))) 
		inp_str = unit.toString();
	 else	
		inp_str = obj.value;
	 if (inp_str.indexOf(".") > 0)
		delta = Math.pow(10,inp_str.length - (inp_str.indexOf(".")+1));
	 else
		delta = 1;
	 //alert (inp_str + "    " + inp_str.indexOf(".") + "   " + delta);
	if (action=='+')
	{
			if (obj.value*delta +unit*delta<=max*delta)
			 {obj.value=Math.round(obj.value*delta+unit*delta)/delta;};};
	if (action=='-')
	{
			if (obj.value*delta -unit*delta>=min*delta)
			 {obj.value=Math.round(obj.value*delta-unit*delta)/delta;};};
	}
	
/**********************************************************************
 * functions Allow_to_enter(param_chars_to_enter)
 *************************************************
 *example:Allow_to_enter('1234567890')-you can enter only those numbers.
 *this function allow the user to enter only the keys that in the string
 *you give her.
 **********************************************************************/
 
function Allow_to_enter(param_chars_to_enter)
	{
		var isok_flag='no'; 
		var chars_to_enter;
		chars_to_enter = param_chars_to_enter.toUpperCase();
		chars_to_enter = chars_to_enter.replace('/',String.fromCharCode(111)+String.fromCharCode(191)); // replace the slashes
		for (var ii=0; ii< chars_to_enter.length;ii++)
			{
				if ((!(event.shiftKey &&( 47<event.keyCode && event.keyCode<58 ||(event.keyCode!=221 || event.keyCode!=190 || event.keyCode!=189 )))
				&&(event.keyCode==chars_to_enter.charCodeAt(ii) ||(event.keyCode==chars_to_enter.charCodeAt(ii)+48 
				&& 95<event.keyCode && event.keyCode<106)|| event.keyCode==8 || event.keyCode==37 || event.keyCode==39 
				|| event.keyCode==16 || event.keyCode==46 || (event.keyCode==190) 
				&& (chars_to_enter.charCodeAt(ii)==46) || (event.keyCode==189) && ((chars_to_enter.charCodeAt(ii)==45)) )) || event.keyCode==9 || (event.shiftKey && event.keyCode==186 && chars_to_enter.charCodeAt(ii)==58))
					
					{
						isok_flag='yes';
					};
			};
		if (isok_flag!='yes') 
			{event.returnValue =false;}
	};

/**********************************************************************
 functions Block_enter 
 ************************
 * block the Enter key in the page
 **********************************************************************/

function Block_enter() 
{
	if (event.keyCode==13)
	{
 	event.returnValue =false;
	}
	else
	{
	}
}

/**********************************************************************
 functions ifEnter(x) 
 ************************
 * If the user press the enter key we can do an action
 * example:ifEnter(alert('itsik'))
 **********************************************************************/
function ifEnter(x)
{
	if (event.keyCode==13)
		{
		eval(x);
		}
	}	

/**********************************************************************
 functions Block_Illegal_Chars (chars_to_block)
 **********************************************
 *example: Block_Illegal_Chars('1234567890')-block the nums.
 * this function block the char " or the char ' by default
 * but if you call to her with string she block those keys.
 **********************************************************************/
function Block_Illegal_Chars(chars_to_block)
{
   
	if (chars_to_block != null) 
	{
	chars_to_block=chars_to_block.toUpperCase();
		for (var i=0; i< chars_to_block.length;i++) 
		{
			if (event.keyCode==chars_to_block.charCodeAt(i))
			{
			event.returnValue =false;
			}
		}
	}
	// Yaniv #3631
	// THIS IS THE OLD IF: 
	// else if ((event.keyCode==222) || (event.shiftKey && event.keyCode==54))
	// it was changed from the following reasons- ^ (54) key shouldn't be blocked anymore.
	// 222 key ( ' and " ) should block only "
	else if ((event.keyCode==222) || (event.shiftKey && event.keyCode==54))
			{
				event.returnValue =false;
			};
}



//added by yehuda to prevent the ("<>&") chars
function Block_Illegal_Chars1(chars_to_block)
{
   
	if (chars_to_block != null) 
	{
	chars_to_block=chars_to_block.toUpperCase();
		for (var i=0; i< chars_to_block.length;i++) 
		{
			if (event.keyCode==chars_to_block.charCodeAt(i))
			{
			event.returnValue =false;
			}
		}
	}
	else if ((event.keyCode==222) || (event.shiftKey && event.keyCode==54) || (event.shiftKey && event.keyCode==55)||(event.shiftKey && event.keyCode==188)||(event.shiftKey && event.keyCode==190) )
			{
				event.returnValue =false;
			};
}

/**********************************************************************
 functions change_status_button(pic_name,status,pic_src)
 **********************************************************************/
function change_status_button(pic_name,status,pic_src)
{
	var ThisStatus
	eval ('status_of_'+pic_name+' ='+status+';');
	animation(pic_name,pic_src)
}

/**********************************************************************
 functions animation
 **********************************************************************/
function animation(pic_name,pic_src)
 {
 
document[pic_name].src=pic_src


 }

/**********************************************************************
 functions animation_Status
 **********************************************************************/
function animation_Status(pic_name,pic_src)
 {
	var ThisStatus
	eval ('ThisStatus = status_of_'+pic_name+';');
	if (ThisStatus == true)
		{document[pic_name].src=pic_src}
 }


/*****************************************************************
  function makes all the document disable 
  parameter: the form object
  example:
   if the form in the document is defined with the name FormName so
   the function should be called this way : 
           disableAllDocumentElements(document.FormName)
*******************************************************************/
function disableAllDocumentElements(formObj)
{

  for(i=0;i<formObj.elements.length  ;i++) //making all elements in the form disabled during submiting
      formObj.elements[i].disabled=true;
 
  for(i=0;i<document.images.length ; i++)    //preventing  all images to response to the event onclick
     document.images[i].onclick="return false";
  
  for(i=0;i<document.links.length;i++)       //preventing all links from responsing
  {
	//document.links[i].href = 'JavaScript:cancelLink();';
	document.links[i].onclick = cancelLink;
  } 
}

/***************************************************
Function which do NOTHING used to disable links
***************************************************/
function cancelLink () { return false; }      



/***************************************************
 trim for javascript functions 

// Add a function called trim as a method of the prototype 
// object of the String constructor.
// Use a regular expression to replace leading and trailing 
// spaces with the empty string
****************************************************/

String.prototype.trim = function()
{
  return this.replace(/(^\s*)|(\s*$)/g, "");
}

/***************************************************
If form contains a multiple select (double select list)
select_all_multiple() function should be called before 
submit form action.
****************************************************/
function select_all_multiple()
{
	var hidden_obj;
	var sel_collect = document.all.tags('select')
	for (i=0; i<sel_collect.length; i++)
		if (sel_collect(i).multiple && sel_collect(i).name.substring(sel_collect(i).name.length-1,sel_collect(i).name.length) != '2')
		{
			hidden_obj =  eval('document.all.hidden'+sel_collect(i).name.substring(6,sel_collect(i).name.length-1)+'Values')
			hidden_obj.value = '';
			for(j=0; j<sel_collect(i).length; j++)
			{
				//sel_collect(i).options[j].selected = true;
				hidden_obj.value = hidden_obj.value + sel_collect(i).options[j].value + ',';
			}	
			hidden_obj.value = hidden_obj.value.substring(0,hidden_obj.value.length-1);
			//alert(sel_collect(i).name + '--'+hidden_obj.value);			
		}		
	 
}

/**********************************************************************
 functions Block_Non_Digits_Chars ()
 **********************************************
 *Block_Non_Digits_Chars()-block the not nums, but user still can edit text
 *example: 
 **********************************************************************/

function Block_Non_Digits_Chars()
{
	//alert(event.keyCode);
	if ((event.keyCode <48) || (event.keyCode >57))
		if ((event.keyCode !=35) && (event.keyCode !=36)&& (event.keyCode !=46)&& (event.keyCode !=45)&& (event.keyCode !=8))
			event.returnValue =false;
	/*  48-57: Numbers
		46	 : DEL
		45	 : INS
		8	 : BackSpace
		36	 : HOME
		35	 : END
	*/		
}

/**********************************************************************
 functions Block_Illigal_Paste_Chars ()
 **********************************************
 *Block_Illigal_Paste_Chars()-block the single and double quote signs when paste event occures.
 *example: 
 **********************************************************************/

function Block_Illigal_Paste_Chars() 
{
	var my_str;
	
	my_str=window.clipboardData.getData("Text");
	if (my_str.indexOf("'")>-1 || my_str.indexOf('"')>-1) 
	{
		event.returnValue = false;
	}

}

/**********************************************************************
 functions Block_Illigal_Drop_Chars ()
 **********************************************
 *Block_Illigal_Drop_Chars()-block the single and double quote signs when paste event occures.
 *example: 
 **********************************************************************/

function Block_Illigal_Drop_Chars(fieldname,length) 
{
	var my_str;
	
	my_str=event.dataTransfer.getData("Text");
	if (my_str.indexOf("'")>-1 || my_str.indexOf('"')>-1 ||  eval("document.all." + fieldname + ".value.length")+my_str.length> length)
	{
		event.returnValue = false;
	}

}


/**********************************************************************

ConfirmAction - Show are you sur message to the user and return true/false
                According to the user selections.
                
                Action - Name of the action to present to the user. default = 'delete'
                Entity - Name of the entity that the action refer to.
						 This string will be present to the user. default = 'item'                

 **********************************************************************/
function ConfirmAction(Action,Entity,Message,Scroll)
{
	if (!Message)
	{
		if (!Action) Action = 'delete';
		if (!Entity) Entity = 'item';
		Message = 'Are you sure you want to ' + Action + ' this ' + Entity + '?';
	};
	var width;
	if (Scroll=='yes')
		width = 325;
	else
		width = 305;
		
	var ret = window.showModalDialog('/common/message.asp?theMessage=' + Message + '&Buttons=yes,no&vertscroll=' + Scroll,
									 window,'status:no;dialogWidth:'+width+'px;dialogHeight:205px;help:0;');
	if (ret=='yes') {return (true) } else {return(false)};
};



/**********************************************************************
	function OpenNotification(Message,pause,status)
	display a message in a pop up with an ok button
		Message - The message string
		Pause   - If to close the window after the timeout that is specified in the preferences.
				  1 = Close (default); 0 = Wait for the user to press OK.
		Status  - 1 = Negative message (red letters); 
				  else = Positive message (blue letters - Default)
 **********************************************************************/

function OpenNotification(Message,pause,status)
{
	if (!(pause))  {pause ='0'} else pause ='1'; //change the vars to string (0/1)
	if (!(status)) {status='0'} else status='1';
	window.showModalDialog('/common/message.asp?theMessage=' + Message + 
						   '&Buttons=ok&status='+status+
						   '&pause='+pause
						   ,window,'status:no;dialogWidth:305px;dialogHeight:205px;help:0;');
}

/**********************************************************************
 functions SetRequiered(pic_name,required)
 set the stat of the icon in put_lable
 **********************************************************************/
 
function SetRequiered(pic_name,required)
{
	if (required)
	{
		document[pic_name].src='/images/requedit.gif'
	}
	else
	{
		document[pic_name].src='/images/reik2.gif'			
	};
}





/**********************************************************************
	function FnChkDragStr(RegExpMaskInstr, allowQte)
	to be used captureing the 'onDrop' event 
	- e.g.: onDrop="FnChkPstStr('[^-. \\d]', false);" will allow only -0.123456789 chars
	
	Params-
	'RegExpMaskInstr' 	- a string that contains regular expression of all permitted chars. 
						  don't enter qoute (") sign in this expression.
	'allowQte'			- true/false - qoutes(") enabled.
	
	Output- 
		If the dragged data string contains only chars from the mask- String.  
			else - nothing. 						  

 **********************************************************************/

function FnChkDragStr(RegExpMaskInstr, allowQte)
{
	var sInputTEXT = event.dataTransfer.getData("TEXT")
	var r = new RegExp (RegExpMaskInstr)
	if (sInputTEXT != null) {
		var sInputTEXT2 = sInputTEXT;
		if (allowQte) {
			sInputTEXT2= sInputTEXT.replace('"','');
			sInputTEXT= sInputTEXT.replace('"','');
			}
		else	{
			sInputTEXT= sInputTEXT.replace('"','');
			}
			
		if (sInputTEXT2 == sInputTEXT.replace(r, '')) {
				event.returnValue=true;
				return;
		}
		else	{
				event.returnValue=false;
				return;
		}
	}
}



/**********************************************************************
	function FnChkPstStr(RegExpMaskInstr, allowQte)
	check the clipboard data to fit the 'RegExpMaskInstr' mask.
	to be used captureing the 'onPaste' event 
	- e.g.: onPaste="FnChkPstStr('[^-. \\d]', false);" will allow only -0.123456789 chars
	
	Params-
	'RegExpMaskInstr' 	- a string that contains regular expression of all permitted chars. 
						  don't enter qoute (") sign in this expression.
	'allowQte'			- true/false - qoutes(") enabled.
	
	Output- 
		If the dragged data string contains only chars from the mask- String.  
			else - nothing. 						  

 **********************************************************************/

function FnChkPstStr(RegExpMaskInstr, allowQte)
{
    sInputTEXT = clipboardData.getData("TEXT")

	var r = new RegExp (RegExpMaskInstr)
	
	var sInputTEXT2 = sInputTEXT;
	if (allowQte) {
			sInputTEXT2= sInputTEXT.replace('"','');
			sInputTEXT= sInputTEXT.replace('"','');
	}
	else	{
			sInputTEXT= sInputTEXT.replace('"','');
	}
	
	if (sInputTEXT2 == sInputTEXT.replace(r, '')) {
			event.returnValue= true; 
			return;
	}
	else 	{
			event.returnValue=false;
			return;
	}
}




function FnChkKeyPrs(RegExpMaskInstr,allowQte, AllowShiftKey)
{
	var sAnchorCode = event.keyCode;
	//capture " and allow. then exit
	if ( sAnchorCode == 222 & event.shiftKey & allowQte) {event.returnValue = true; return;}
	//capture " and disallow. then exit
	if ( sAnchorCode == 222 & event.shiftKey & !allowQte){event.returnValue = false; return;} 

	//capture : and allow. then exit
	var template = /:/  ;
 	if ( sAnchorCode == 186 & event.shiftKey & template.test(RegExpMaskInstr) ) {event.returnValue = true; return;} 

	// capture and allow delete+backspace(8,46), tab(9),  arrows (35-40) and keyboard CTRL-X, CTRL-C and CTRL-V
	if (sAnchorCode == 8 || sAnchorCode == 9 || sAnchorCode == 46 ||  sAnchorCode >= 35 &&  sAnchorCode <= 40 || sAnchorCode==67 && event.ctrlKey || sAnchorCode==86 && event.ctrlKey || sAnchorCode==88 && event.ctrlKey) {
		event.returnValue = true;
		return;
	}
	else {
		if (sAnchorCode >=96 && sAnchorCode <=105) sAnchorCode= sAnchorCode -48;
		
	    sAnchorStr = String.fromCharCode(sAnchorCode);

		if (sAnchorCode == 109 || sAnchorCode == 189) 	sAnchorStr = '-';
		if (sAnchorCode == 110 || sAnchorCode == 190) 	sAnchorStr = '.';
		if (sAnchorCode == 191 || sAnchorCode == 111)   sAnchorStr = '/';
		
		var r = new RegExp (RegExpMaskInstr)
			if ((sAnchorStr == sAnchorStr.replace(r, ''))  && (!(!AllowShiftKey && event.shiftKey))) {
					event.returnValue = true;
					return;
			}
			else 	{
					event.returnValue = false;
					return;
			}
	}

}
/******************************************************************************************************************
	popuppage
******************************************************************************************************************/	
function popuppage(page,w,h)
{
	window.open(page,'','height='+h+',width='+w+',status=yes,resizable=yes,scrollbars=yes,toolbar=no,menubar=no,location=no,left=100,top=0');
}

/******************************************************************************************************************
	funtion AddToFav enables
******************************************************************************************************************/	
function AddToFav(url)
{
    browserName = navigator.appName;
	browserVer = parseInt(navigator.appVersion);
	if (browserName == "Microsoft Internet Explorer" && browserVer >= 4) 
	{
      		window.external.AddFavorite(url,"e-Med.co.il");
    }
	return false;
} 
function ChangeWinStatus(strStatus)
{
	window.status = strStatus;
}

function DisableRightClick()
{
	document.onmousedown= Closepop; 
	document.oncontextmenu = function(){return false}
}

function ClosePopup(command, args)
{
	if (command == 'hide') { document.getElementById('Popuplayer').style.visibility = "hidden"; }
}
function ClickOnBanner(PageToOpen,LinkNum,CatID,Size)
{
	var UrlToOpen=PageToOpen + '?LinkNum='+ LinkNum + "&catid="+CatID;
	if (Size) UrlToOpen+="&size=" + Size;
	window.open(UrlToOpen,'BannerPopup')
}
function ClickOnJumpFlash(UrlToOpen)
{
	UrlToOpen="http://" + UrlToOpen;
	window.open(UrlToOpen,'BannerPopup')
}
function repositionDiv(){
    var obj = document.getElementById('Popuplayer'); // creating reference to object.
    obj.style.top = (100 + document.body.scrollTop/1) + 'px';
    //obj.style.left = (10 + document.body.scrollLeft/1) + 'px';
}
function setEvents(){
    if(document.all){
        document.getElementById('Popuplayer').style.position='absolute'; // Setting position of div to absolute
        window.onscroll=repositionDiv; // Adding onscroll event.
        window.onresize=repositionDiv; // Adding onscroll event.
    }
}
function ShowLoginForm()
{
	LoginDetDiv.style.display='block';
}
function ShowUpdateUserLink()
{
	updateUserTD.style.display='block';
	updateUserTDDown.style.display='block';
}
function LoadObject(containerID)
{
    var obj=document.getElementById(containerID);
	var tmpHTML=obj.innerHTML;
	obj.innerHTML='';
	obj.innerHTML = tmpHTML;
}
function IsIE8() {
    var returnValue = false;
    if (navigator.appName == 'Microsoft Internet Explorer') {
        returnValue = navigator.userAgent.indexOf("MSIE 8") > -1;
    }
    return returnValue;
}
function ShowHugeBanner(fileName) {
    var HostedObject = document.getElementById("HugeBanner");
    if (document.getElementById('Huge_Banner') == null) {
    	if (typeof (fileName) == 'undefined') {
    		if (document.getElementById("logo").movie == null) {
    			fileName = document.getElementById("logo").children.item("movie").value.replace(".swf", "_Huge.swf");
    		}
    		else {
    			fileName = document.getElementById("logo").movie.replace(".swf", "_Huge.swf");    			
    		}
        }
        HostedObject.innerHTML = GetFlashHTMLObject("Huge_Banner", 660, 200, fileName);
    }
    document.getElementById('UpBanner').style.display = 'none';
    HostedObject.style.display = 'block';
}
function HideHugeBanner() {
    var HostedObject = document.getElementById("HugeBanner");    
    HostedObject.style.display = 'none';
    document.getElementById('UpBanner').style.display = 'block';
}

function ShowArticleBanner(fileName) 
{
    var HostedObject = document.getElementById("spanContainer");
    if ((document.getElementById('Inside_Huge_Banner') == null)) 
    {
        if (typeof (fileName) == 'undefined') {
        	if (document.getElementById("insideFlash").movie == null) {
        		if (document.getElementById("insideFlash").children.item("movie").src == null) {
        			fileName = document.getElementById("insideFlash").children.item("movie").value.replace(".swf", "_Huge.swf");
        		}
        		else {
        			fileName = document.getElementById("insideFlash").children.item("movie").src.replace(".swf", "_Huge.swf");
        		}
        	}
        	else {
        		fileName = document.getElementById("insideFlash").movie.replace(".swf", "_Huge.swf");
        	}
        }
        HostedObject.innerHTML += GetFlashHTMLObject("Inside_Huge_Banner", 300, 500, fileName);
        document.getElementById('Inside_Huge_Banner').style.display = 'none';
    }
    document.getElementById("insideFlash").style.display = 'none';
    if (document.getElementById("Inside_Huge_Banner").length > 0) {
    	document.getElementById("Inside_Huge_Banner")[0].style.display = 'block';
    }
    else {
    	document.getElementById("Inside_Huge_Banner").style.display = 'block';
    }
}
function HideArticleBanner() {
	if (document.getElementById("Inside_Huge_Banner").length > 0) {
		document.getElementById("Inside_Huge_Banner")[0].style.display = 'none';
    }
    else {
    	document.getElementById("Inside_Huge_Banner").style.display = 'none';
    }
    document.getElementById("insideFlash").style.display = 'block';
}
function ExpandBanner(HostedType, fileName) {

    switch (HostedType) {
        case "Huge":
            ShowHugeBanner(fileName);
            break;
        case "Article":
            ShowArticleBanner(fileName);
            break;
    }          
}
function CollapsBanner(HostedType, fileName) {

    switch (HostedType)
    {
        case "Huge":
            HideHugeBanner();
            break;
        case "Article":
            HideArticleBanner();
            break;    
    }
}
function GetFlashHTMLObject(id, w, h, movie) {

    var rt = '<OBJECT id="' + id + '" name="' + id + '" ' +
    'codeBase="http://fpdownload.macromedia.com/get/flashplayer/current/swflash.cab" ' +
    'classid=clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="' + w + '" height="' + h + '" ' +
    'type="application/x-shockwave-flash"><PARAM NAME="Movie" ' +
    'VALUE="' + movie + '"><PARAM NAME="Src" ' +
    'VALUE="' + movie + '">' +
    '    <embed ' +
    'src="' + movie + '" play="true" width="' + w + '" height="' + h + '" id="' + id + '" quality="high" ' +
    'name="' + id + '" allowScriptAccess="sameDomain" ' +
    'pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash"  ' +
    '></embed></OBJECT>'
    return rt;
}

function DoSearch(page, order, sql, CatID, hosted) {

    if (typeof (hosted) == "undefined")
        hosted = document;
    if (typeof (CatID) != "undefined")
        hosted.frmAdvancedSearch.CatID.value = CatID;
    if (typeof (sql) != "undefined")
    {
        hosted.frmAdvancedSearch.action="/emed/new/usersite/AdvancedSearch.asp";
	hosted.frmAdvancedSearch.AdvSQL.value = sql;
    }
    hosted.frmAdvancedSearch.order.value = order;
    hosted.frmAdvancedSearch.page.value = page;
    hosted.frmAdvancedSearch.submit();
}
function OpenTelerikEditor() {
    var newWindow;
    newWindow = window.open('Editor/Telerik/RadEditor.aspx', 'newWindow', 'toolbar=no,menubar=no,resizable=yes,scrollbars=yes,status=no,location=no,width=1024,height=700');
    newWindow.focus();
}
function showSystemSplashWindow(splashType,windowObj){   
	try
	{ 
	    //debugger;
	    //alert(windowObj.document.body.readyState +'___' + splashType + '___' + (splashType=='Disclaimer'));
	    if (typeof(windowObj)=="undefined")
	    {
		    windowObj = window;
		}
		if(windowObj.document.body.readyState=="complete" || window.addEventListener)
		{
			if (windowObj.document.getElementById('updatedetails')==null)
			{
				var w = windowObj.document.body.clientWidth-3;
				var h = windowObj.document.body.scrollHeight-3;
				//WaitingDiv = "<iframe border=0 frameborder=0 id='updatebg' src='../wait.htm' style='display:none;z-index:1001;filter:progid:DXImageTransform.Microsoft.Alpha(opacity=40);position:absolute;top:1px;left:1px;width:"+w+";height:"+h+";background-color:red'></iframe>";
				
				var newDiv = document.createElement('DIV');
			    newDiv.id = "updatedetails";
				switch (splashType)
				{
				    case 'NoCoockies':
				        WaitingDiv = GetNoCoockiesInnerHTML();
				        break;
				    case 'UpdateDetails':
				        WaitingDiv = GetUpdateUserDetailsInnerHTML();
				        break;
				    case 'Disclaimer':
				        WaitingDiv = GetDisclaimerInnerHTML();
				        break;
				    case 'ActivationNeeded':
				    	WaitingDiv = GetActivationNeededInnerHTML();
				        break;
				}
				newDiv.innerHTML = WaitingDiv;  
				windowObj.document.body.appendChild(newDiv);
				//windowObj.document.body.insertAdjacentHTML("afterEnd",WaitingDiv);
				
				var newIFrame = document.createElement('IFRAME');
			    newIFrame.id = "detFrame";
			    newIFrame.border=0;
			    newIFrame.frameborder=0;
			    newIFrame.style.filter="progid:DXImageTransform.Microsoft.Alpha(opacity=40)";
			    newIFrame.style.width=w;
				newIFrame.style.height=h;
				newIFrame.style.zIndex=1001;
				newIFrame.style.position="absolute";
				newIFrame.style.top="1px";
				newIFrame.style.left="1px";
				windowObj.document.body.appendChild(newIFrame);
			}

			windowObj.status = 'שים לב ! הנך גולש כעת כאורח.'; 
			windowObj.document.body.style.cursor = "default";
			windowObj.document.body.style.overflow="hidden";
			windowObj.document.getElementById("updatedetails").style.zIndex=1002;
			windowObj.document.getElementById("updatedetails").style.width="100%"
			windowObj.document.getElementById("updatedetails").style.height="100%"
			windowObj.document.getElementById("updatedetails").style.display="";
			//windowObj.document.body.style.cursor = "wait";
		}
	}
	catch(e){}
} 
function hideWaitingSplash()
{
	if (document.getElementById("updatedetails")!=null)
	{
		document.getElementById("updatedetails").style.display='none';	
	}
	if (document.getElementById("detFrame")!=null)
	{
		document.getElementById("detFrame").style.display='none';	
	}
	window.status ='';
	window.document.body.style.cursor = "default";
	window.document.body.style.overflow="";
}
function GetNoCoockiesInnerHTML()
{
    var sRes = '';
    sRes += '<DIV id=updatebg>';
    sRes += '<DIV dir=rtl align=center>';
    sRes += '<H3>שים לב ! הנך גולש כעת כאורח. </H3>';
    sRes += '<UL>';
    sRes += '<LI>אם אתה מנוי נא הכנס סיווגך וסיסמתך <A target="_self" href="javascript:GotoLogin();">כאן</A>.</LI>';
    sRes += '<LI>אם אינך זוכר סיסמתך נא הקלק <A target="_self" href="javascript:GotoPasswordRecovery();">כאן</A>.</LI>';
    sRes += '<LI>אם אינך מנוי עדיין ואתה בעל אחד ממקצועות הרפואה והבריאות הנך מוזמן לבצע   הרשמה <A target="_self" href="javascript:GotoAccountCreation();">כאן</A>.</LI>';
    sRes += '<LI>אם הנך מבקר בלבד הקלק <A target="_self" href="javascript:ContinueAnonymously();">כאן</A> להמשך   גלישה. </LI>';
    sRes += '</UL>';
    sRes += '</DIV></DIV>';
    
    return sRes;
}

function GetUpdateUserDetailsInnerHTML()
{
    var sRes = '';
    sRes += '<DIV id=badEmailBg>';
    sRes += '<DIV dir=rtl align=center>';
    sRes += '<H3>שים לב ! ע״פ הנתונים שבידנו כתובת המייל שלך כפי שמופיעה במאגר שלנו אינה תקינה. </H3>';
    sRes += '<UL>';
    sRes += '<LI>אנא הכנס לכרטיסך<A target="_self" href="javascript:GotoUpdateAccount();"> כאן </A>ועדכן פרטיך. תודה !</LI>';
    sRes += '</UL>';
    sRes += '</DIV></DIV>';
    
    return sRes;
}

function GetDisclaimerInnerHTML()
{
    var sRes = '<CENTER>';
    sRes += '<DIV id=DisclaimerBg>';
    sRes += '<DIV dir=rtl align=center>';
    sRes += '<H3>הצהרה של הנכנס לאתר</H3>';
    sRes += '<DIV dir=rtl align=right>';
    sRes += '<P>ידוע לי כי הכניסה לאתר זה ועיון במידע שבאתר זה, מותרים אך ורק לחברי הקהיליה הרפואית בישראל הכוללת רופאים ,רוקחים ,אחים/אחיות ,תזונאים ואנשי מקצועות בריאות בעלי הכשרה ורשיון לעסוק במקצועם, או למי שקיבל הרשאה מיוחדת ממנהלי האתר. </P>';
    sRes += '<P>המידע באתר זה, המיועד כאמור לאנשי המקצוע בלבד, איננו בגדר הנחיות או המלצות לטיפול ואינו מהווה תחליף לייעוץ מקצועי של רופא מומחה. </P>';
    sRes += "<P>כל המידע באתר זה, אשר מובא מטעם חברות תרופות, ציוד רפואי, מזון רפואי וכד', וכן המידע מטעם ארגונים רפואים שונים, הוא על אחריות הגוף אשר העביר אלינו את המידע. </P>";
    sRes += '<DIV align=center><BR> ';
    sRes += '<A target="_self" href="javascript:hideWaitingSplash();">אני מסכים ומצהיר בזאת כי אני עומד בתנאים לכניסה לאתר</A>';
    sRes += '</DIV></DIV></DIV></DIV></CENTER>';
    
    return sRes;
}

function GetActivationNeededInnerHTML()
{
    var sRes = '';
    sRes += '<DIV id=activationBg>';
    sRes += '<DIV dir=rtl align=center><H3>';
    sRes += '<P>שים לב ! המנוי שלך באתר עדיין אינו פעיל .</P>';
    sRes += '<P>בכדי להפוך המנוי לפעיל עליך להקליק על הקישור שנשלח אליך במייל. </P></H3>';
    sRes += '<UL>';
    sRes += '<LI>להמשך גלישה כאורח – נא הקלק  <A target="_self" href="javascript:hideWaitingSplash();">כאן</A>. </LI>';
    sRes += '<LI>במידה ולא קיבלת מייל להפעלת המנוי נא הכנס לחשבונך בדוק ותקן את כתובות המייל המופיעה שם. הקלק  <A target="_self" href="javascript:GotoUpdateAccount();">כאן</A> לכניסה. </LI>';
    sRes += '</UL>';
    sRes += '</DIV></DIV>';
    
    return sRes;
}
function GotoLogin()
{
    hideWaitingSplash();
    document.getElementById("password").focus();
}
function GotoAccountCreation()
{
    hideWaitingSplash();
    popuppage('http://www.e-med.co.il/emed/new/usersite/AddNewUsers.asp?discl=1',780,640);
}
function GotoUpdateAccount()
{
    hideWaitingSplash();
    popuppage('http://www.e-med.co.il/emed/new/usersite/EditSiteUsers.asp',800,600);
}
function GotoPasswordRecovery()
{
    hideWaitingSplash();
    popuppage('http://www.e-med.co.il/emed/new/usersite/ForgetPwd.asp',800,300);
}
function ContinueAnonymously()
{
     hideWaitingSplash();
}
function MailString()
{
    var mailbody = 'שם:%0D%0A שם משפחה:%0D%0A מס. רשיון:%0D%0A';
    var sRes ='mailto:webmaster@e-med.co.il?';
    sRes += 'subject=Password recovery request';
    sRes += '&body=' + mailbody;
    
    return sRes;
}

/*********TRAILER RELATED FUNCTIONS START******/
/****** CODE FOR FLOATING WINDOW + MOVE/MAXIMIZEI/MINIMIZE FUNCTIONALITY */
var IE_elements=document.all&&document.getElementById;
var other_elements=document.getElementById&&!document.all;
var flag=false;
var restore_flag=0;
var wwidth,wheight;
var TopLeft=0;
var WidthHeightGap=3;

//Code to define window width/height
var MaxWidth = 0, MaxHeight = 0;
if( typeof( window.innerWidth ) == 'number' ) 
{
  //Non-IE
  MaxWidth = window.innerWidth;
  MaxHeight = window.innerHeight;
} 
else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) 
{
  //IE 6+ in 'standards compliant mode'
  MaxWidth = document.documentElement.clientWidth;
  MaxHeight = document.documentElement.clientHeight;
} 
else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) 
{
  //IE 4 compatible
  MaxWidth = document.body.clientWidth;
  MaxHeight = document.body.clientHeight;
}

function MyDragAndDrop(e)
{
    if (IE_elements&&flag&&event.button==1)
    {
        document.getElementById("mywindow").style.left=tempx+event.clientX-offsetx+"px";
        document.getElementById("mywindow").style.top=tempy+event.clientY-offsety+"px";
    }
    else if (other_elements&&flag)
    {
        document.getElementById("mywindow").style.left=tempx+e.WinX-offsetx+"px";
        document.getElementById("mywindow").style.top=tempy+e.WinY-offsety+"px";
    }
}

function Window_Drag_Finished()
{
    flag=false;
    document.getElementById("mywindow").onmousemove=null;
    document.getElementById("mywindowcontent").style.display=""; //extra
}

function checkIE()
{
    return (!window.opera && document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body;
}
function Initialization(e)
{
    offsetx=IE_elements? event.clientX : e.WinX;
    offsety=IE_elements? event.clientY : e.WinY;
    document.getElementById("mywindowcontent").style.display="none"; //extra
    tempx=parseInt(document.getElementById("mywindow").style.left);
    tempy=parseInt(document.getElementById("mywindow").style.top);
    flag=true;
    document.getElementById("mywindow").onmousemove=MyDragAndDrop;
}
function Window_Load(url,width,height,frameInnerHTML)
{
    if (!IE_elements&&!other_elements)
    {
	    window.open(url,"","width=width,height=height,scrollbars=1");
	}
    else
    {
        document.getElementById("mywindow").style.display='';
        document.getElementById("mywindow").style.width=wwidth=width+"px";
        document.getElementById("mywindow").style.height=wheight=height+"px";
        document.getElementById("mywindow").style.left=TopLeft + "px";
        document.getElementById("mywindow").style.top=other_elements? window.pageYOffset*1+TopLeft+"px" : checkIE().scrollTop*1+TopLeft+"px";
        if(url != '')
        {
			document.getElementById("cframe").src=url;
		}
		else if(frameInnerHTML != '')
		{
			var tFrame = document.getElementById("cframe");
			var doc = tFrame.contentDocument;
			if (doc == undefined || doc == null)
			    doc = tFrame.contentWindow.document;
			doc.open();
			doc.write(unescape(frameInnerHTML));
			doc.close();
		}
        
        document.getElementById("mywindowcontent").style.width=wwidth;
        document.getElementById("mywindowcontent").style.height=wheight;
        
        document.getElementById("cframe").style.width=wwidth;
        document.getElementById("cframe").style.height=wheight;

    }
}
function Window_Maximized()
{
    if (restore_flag==0)
    {
        restore_flag=1; //Window_Maximized window
        document.getElementById("maxname").setAttribute("src","restore.gif");
        document.getElementById("mywindow").style.width=other_elements? window.innerWidth-WidthHeightGap+"px" : checkIE().clientWidth-WidthHeightGap+"px";
        document.getElementById("mywindow").style.height=other_elements? window.innerHeight-WidthHeightGap+"px" : checkIE().clientHeight-WidthHeightGap+"px";
    }
    else
    {
        restore_flag=0; //restore window
        document.getElementById("maxname").setAttribute("src","max.gif");
        document.getElementById("mywindow").style.width=wwidth;
        document.getElementById("mywindow").style.height=wheight;
    }
    document.getElementById("mywindow").style.left=other_elements? window.pageXOffset+"px" : checkIE().scrollLeft+"px";
    document.getElementById("mywindow").style.top=other_elements? window.pageYOffset+"px" : checkIE().scrollTop+"px";
}

function Window_Close()
{
    if (document.getElementById("mywindow") != null)
		document.getElementById("mywindow").style.display="none";
    
    document.getElementById("general").style.display="";
    
    var arr = new Array();
    arr = document.getElementsByTagName( "IFRAME" );
    
    for(var i=0; i < arr.length; i++)
    {
        if (arr[i].id != 'cframe' && arr[i].id != 'BannerSelector')
        {
			arr[i].src = arr[i].src;
		}
    }
}
/*********TRAILER RELATED FUNCTIONS END********/
