﻿//window.onresize = setBigPicPos;
window.onload =function ()
{
	if(screen.width==800 ||screen.height== 600)
	{
		window.scroll(screen.width,0);
	};
}
function popUpMsg(pageID,Height) {
    window.open("popUpMsg.aspx?pageID="+pageID,"","height=" + Height + " , width=450, left=200, top=100, location=no, menubar=no, resizable=yes, scrollbars=yes, status=no, titlebar=no, toolbar=no");
}

function setBigPicPos()
{
	try
	{
		if(document.body.clientWidth < 990)
		{
			document.getElementById("bigAdd").style.display = 'none';
		}
		else
		{
			document.getElementById("bigAdd").style.display = "";
		}
	}catch(err){
	}
}
		
/* paging function ************************************************/
		function getSelectedItems(msg_id,hiddenName)
		{
			var checkBoxId = msg_id;
			var tmp = document.getElementById(hiddenName).value;	
			//-----------------------------------------------
			 if (document.getElementById(checkBoxId).checked)
			{
				if (document.getElementById(hiddenName).value == "")
				{
					document.getElementById(hiddenName).value += msg_id;
				}
				else
				{	
					if (tmp.indexOf(msg_id) == -1)				
						document.getElementById(hiddenName).value += ","+msg_id;
				}
				
				//alert(document.getElementById(hiddenName).value);								
			}
			else   //erase this msg_id from the string
			{
				var arr = new Array();
				
				if (tmp.indexOf(msg_id+",") != -1)				
					arr = tmp.split(msg_id+",");
				else				
					if (tmp.indexOf(","+msg_id) != -1)					
						arr = tmp.split(","+msg_id);	
					else				
						if (tmp.indexOf(msg_id) != -1)						
							arr = tmp.split(msg_id);					
												
				
				//document.getElementById(hiddenName).value	= arr.toString();
				str = "";	
				for (i=0; i<arr.length; i++)
				{
					str += arr[i];										
				}
				document.getElementById(hiddenName).value = str;
				
				//alert(document.getElementById("selectedItemsInpt").value);
			}
			
		}
/******************************************************************/
/* restore checked items in datagrid (paging)*/
function restoreCheckedItems(form_name,msgs_id)
{
	var arr = new Array();
	arr = msgs_id.split(",");	
	
	for(i=0; i<arr.length; i++)
	{
		if (document.getElementById(arr[i])!=null)
		if (document.getElementById(arr[i]).checked == false)
		{
			document.getElementById(arr[i]).checked = true;	
			//alert(arr[i].toString());		
		}
	}
}
/* Copied from functions.js */
window.onload =function ()
{	
	if(screen.width==800 ||screen.height== 600)
	{
		window.scroll(screen.width,0);
	};
}		
	
function ShowNunshow (obj,objNum)
    {
        for (i=1;i<=5;i++)
        {
            theObj = eval("document.getElementById(obj+i)");
            if(i!=objNum )
            {
                theObj.style.visibility="hidden";
             
            }
            else if(i==objNum)
            {  
                if(theObj.style.visibility=="visible")
                {
                    theObj.style.visibility="hidden";
                }
                else if(theObj.style.visibility=="hidden"||theObj.style.visibility=="")
                {
                    theObj.style.visibility="visible";
                }
           }
         }
    }
    
w = screen.availWidth;
function toRight() 
{
self.scrollTo(w, 0)
}
/* End of  functions.js */
function popUPwin(url,width,height,id) {
	javascript:client_window=window.open(url ,'_blank',' width=' + width + ' ,height=' + height + ' ,left=0, top=0, location=no, menubar=no, resizable=yes, scrollbars=no');
	client_window.focus() 
}


function goTo(urlString){
	window.location=urlString;
}

document.ondragstart =  function () { return false; }

function ShowDic(AID,PcatId,lng,str){
    window.open("dictionary.aspx?pcatid=" + PcatId + "&findword=" + AID + "&ln=" + lng + "&str=" + str,"dictionary",'width=455,height=470,menubar=no, resizable=yes, scrollbars=yes,left=400,top=100,screenX=400,screenY=100')
}

function print_article_old(MID,PcatID) {
    window.open("printshopcompare.aspx?mid="+MID+"&pcatid="+PcatID,"","height=500, width=790, left=0, top=0, location=no, menubar=no, resizable=yes, scrollbars=yes, status=no, titlebar=no, toolbar=YES");
}

function print_product(MID,PcatID) {
    window.open("p_productDetails.aspx?mid="+MID+"&pcatid="+PcatID,"","height=500, width=780, left=100, top=100, location=no, menubar=no, resizable=yes, scrollbars=yes, status=no, titlebar=no, toolbar=YES");
}


/* Search Product Engine FUNCTIONs*/

			function ShowDic(AID,PcatId,lng,str)
				{
					window.open("Dictionary.aspx?PcatID=" + PcatId + "&FindWord=" + AID + "&Ln=" + lng + "&str=" + str,"Dictionary",'width=455,height=470,menubar=no, resizable=yes, scrollbars=yes,left=400,top=100,screenX=400,screenY=100')
				}
				
				function AddRemoveMultipleSelection(id)
				{
					
					if( document.getElementById("tblParamsSingle_"+id).style.display=="none")
					{
						document.getElementById("tblParamsMulti_"+id).style.display="none";
						document.getElementById("tblParamsSingle_"+id).style.display="block";
						document.getElementById("spanShowMultiText_"+id).innerHTML = "בחירה מרובה";
					}
					else
					{
						document.getElementById("tblParamsSingle_"+id).style.display="none";
						document.getElementById("tblParamsMulti_"+id).style.display="block";
						document.getElementById("spanShowMultiText_"+id).innerHTML = "בחירה בודדת";
					}
				}
				
				function ShowHideExtra(id, prefix)
				{					
					if( document.getElementById("tblParamsSingle_"+id).style.display=="none")
					{
						prefix = "Multi";
					}
					else
					{
						prefix = "Single";
					}
					
					if( document.getElementById("tblExtra_"+prefix+id).style.display=="none")
					{
						document.getElementById("tblExtra_"+prefix+id).style.display="block";
						document.getElementById("spanShowExtraText_"+id).innerText = "סגור";
					}
					else
					{
						document.getElementById("tblExtra_"+prefix+id).style.display="none";
						document.getElementById("spanShowExtraText_"+id).innerText = "עוד";
					}
				}
				
				function ShowHideParam(id)
				{
				    if (document.getElementById("tdSearchParam_"+id) == null)
				        return;
					if( document.getElementById("tdSearchParam_"+id).style.display=="none")
					{						
						document.getElementById("tdSearchParam_"+id).style.display="block";
						document.getElementById("img_"+id).style.display="block";
						document.getElementById("tr_"+id).style.backgroundColor="#FFFFFF";
						
						document.getElementById("tdSearchParam_"+lastVisibleParam).style.display="none";
						document.getElementById("img_"+lastVisibleParam).style.display="none";
						document.getElementById("tr_"+lastVisibleParam).style.backgroundColor="#F3F3F3";
						lastVisibleParam = id;
					}
					else
					{
						document.getElementById("tdSearchParam_"+id).style.display="block";
						document.getElementById("img_"+id).style.display="block";
						document.getElementById("tr_"+id).style.backgroundColor="#FFFFFF";
					}
				}
//				var lastVisibleParam = <%=LastDisplayedParam%>;
				
				function checkSelects()
				{
					//alert();
					document.location.href="SearchPage.aspx?PcatID=<%=PcatID%>";
					return false; 
				}
/*End of Search Product Engine FUNCTIONs*/