function showallrooms(all_G,all_P)
{
		if(all_G > 0)
			{

									document.getElementById('all_G').style.display = "block";
									var url2 = '#rooms';
									window.location.assign(url2);
									var add=1;
									while(add<=all_G)
									{
									document.getElementById('G_'+add).style.visibility = "visible";
									document.getElementById('GURL_'+add).style.display = "none";
									add++;
									}
			}
		if(all_P > 0)
			{
									document.getElementById('all_P').style.display = "block";
									var url2 = '#rooms';
									window.location.assign(url2);
									var add=1;
									while(add<=all_P)
									{
									document.getElementById('P_'+add).style.visibility = "visible";
									document.getElementById('PURL_'+add).style.display = "none";
									add++;
									}
			}
}



function searchsrooms(all_G,all_P) {
var serchid = document.getElementById('search').value;
if(document.getElementById('search').value=='' || document.getElementById('search').value==false)
{
alert('فضلا ادخل رقم او اسم الغرفة');
return false;
}
else if (isNaN(serchid))
{
document.serchrooms.submit();
return true;
}
else if (!isNaN(serchid))
{
var type = document.getElementById('type').value;




					if(type=='G')
					{
					
			
								if(serchid <= all_G)
								{
									if(all_P>0)
									{
									document.getElementById('all_P').style.display = "none";
									}
									document.getElementById('all_G').style.display = "block";
									var url2 = '#'+type+'_'+serchid;
									window.location.assign(url2);
									var add=1;
									while(add<=all_G)
									{
									if(add ==serchid )
									{
									document.getElementById('G_'+serchid).style.visibility = "visible";
									document.getElementById('GURL_'+serchid).style.display = "block";
									}
									else
									{
									document.getElementById('G_'+add).style.visibility = "hidden";
									}
									add++;
									}
									}
								else if(serchid > all_G)
								{
								alert('عفواُ لاتوجد غرفة عامة تحمل هذا الرقم');
								}
					return false;	
					}
					else if(type=='P')
					{
					
			
								if(serchid <= all_P)
								{
									if(all_G>0)
									{
									document.getElementById('all_G').style.display = "none";
									}
									document.getElementById('all_P').style.display = "block";
									var url2 = '#'+type+'_'+serchid;
									window.location.assign(url2);
									var add=1;
									while(add<=all_P)
									{
									if(add ==serchid )
									{
									document.getElementById('P_'+serchid).style.visibility = "visible";
									document.getElementById('PURL_'+serchid).style.display = "block";
									}
									else
									{
									document.getElementById('P_'+add).style.visibility = "hidden";
									}
									add++;
									}
									}
								else if(serchid > all_P)
								{
								alert('عفواُ لاتوجد غرفة خاصة تحمل هذا الرقم');
								}
					return false;	
					}
					

}
}
