//This Comman Function use for  where u want to Select Multiple checkboxes //
function checkUncheckAll(theElement)
{
		
     var theForm = theElement.form, z = 0;

	 for(z=0; z<theForm.length;z++)
	 {
		 	
     	 if(theForm[z].type == 'checkbox' && theForm[z].name != 'checkall')
	  	 {
	  		theForm[z].checked = theElement.checked;
	  	 }
     }
}
function NextPage(frmName,q,count){
	document.getElementById("q").value=q;
	document.getElementById("page").value=count;
	document.getElementById(frmName).submit();	
}

	if(screen != null) 
{ 
var xpos = screen.width;
var ypos = screen.height;
}
else 
{ 
var xpos = 640; 
var ypos = 480; 
}

function pic(pageToLoad, w, h)
{
	var winheight = parseInt(h);
	var scrollingwidth = w+15;
	var scrollingheight = winheight+40;
	var scrolling = 0;
	
	if(xpos > 800) 
	{
		if(h > 700) { scrollingwidth = parseInt(w) ; scrollingheight = 700; scrolling = 1; }
		if(w > 1000) { scrollingheight = parseInt(winheight) ; scrollingwidth = 1000; scrolling = 1; }
		if((w > 1000) && (h > 700)) { scrollingheight = 700; scrollingwidth = 1000; scrolling = 1; }
	}
	else
	{
		if(h > 450) { scrollingwidth = parseInt(w); scrollingheight = 450; scrolling = 1; }
		if(w > 730) { scrollingheight = parseInt(winheight) ; scrollingwidth = 730; scrolling = 1; }
		if((w > 730) && (h > 450)) { scrollingheight = 450; scrollingwidth = 730; scrolling = 1; }
	}
	xposition = (xpos - scrollingwidth) / 2;
	yposition = (ypos - scrollingheight) / 2;
	args = "width=" + scrollingwidth + ","
		+ "height=" + scrollingheight + ","
		+ "location=0, menubar=0, resizable=1, scrollbars=" + scrolling + ","
		+ "status=0, titlebar=0, toolbar=0, hotkeys=0, "
		+ "screenx=" + xposition + ","
		+ "screeny=" + yposition + ","
		+ "left=" + xposition + ","
		+ "top=" + yposition;
	oWin = window.open("","_blank",args);

	pic_pop =  '<HTML><TITLE>BR Films</TITLE>';
	pic_pop += '<BODY text="#000000" rightmargin="0" bottommargin="0" leftmargin="0" topmargin="0" marginwidth="0"  marginheight="0" style="margin:0" bgcolor="#FFFFFF">';
	pic_pop += '<table width="100%" border="0" cellpadding="0" cellspacing="1" bgcolor="#D1D1D1">';
	pic_pop += '<tr>';
	pic_pop += '<td valign="top"><table width="100%" border="0"  bgcolor="#FFFFFF" >';
	pic_pop += '<tr>';
	pic_pop += '<td valign="top"><table>';
	pic_pop += '<tr>';
	pic_pop += '	<td align="center"  class="prod" valign="top"><img src="'+ pageToLoad +'" width="'+ w +'" height="'+ h +'" vspace="0" hspace="0" border="0">'; 
	pic_pop += '</td>';
	pic_pop += '<tr>';
	pic_pop += '<td align="center" colspan="4" >';
	pic_pop += '<input type="button" name="btnadd" value="Close" onClick="window.close();" class="inp01"/></td>';
	pic_pop += '</tr>';
	pic_pop += '</table></td>';
	pic_pop += '			</tr>';
	pic_pop += '		</table></td>';
	pic_pop += '	</tr>'
	pic_pop += '</table>'
	pic_pop += '</BODY></HTML>';

	oWin.document.open();
	oWin.document.writeln(pic_pop);
	oWin.document.close();
}

function popitup(url) {
	newwindow=window.open(url);
//	if (window.focus) {newwindow.focus()}
//	return false;
}

function inputHiddenValue(frmName,q,count){
	document.getElementById("q").value=q;
	document.getElementById("page").value=count;
	document.getElementById(frmName).submit();	
}

var xmlHttp
function movieselection(movieid,flag,viewall,catid)
{ //alert("coming here");
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
	{
	  alert ("Your browser does not support AJAX!");
	  return;
	} 
	
	if(flag == 'wall') {
		url="getmovie.php?wallid="+movieid+"&viewall="+viewall+"&catid="+catid;		
	}	
	if(flag == 'screen') {
		url="getmovie.php?screenid="+movieid+"&viewall="+viewall+"&catid="+catid;	
	}	
	if(flag == 'download') {
		url="getmovie.php?downloadid="+movieid+"&viewall="+viewall+"&catid="+catid;	
	}
	if(flag == 'wall') {
		xmlHttp.onreadystatechange=stateChanged;
	}	
	if(flag == 'screen') {
		xmlHttp.onreadystatechange=stateChanged2;
	}
	if(flag == 'download') {
		xmlHttp.onreadystatechange=stateChanged3;
	}
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
	}
	
function stateChanged() 
{ 	
	if (xmlHttp.readyState==4)
	{ 		
		document.getElementById("divwallpaper").innerHTML=xmlHttp.responseText;		
	}
}
function stateChanged2() 
{ 	
	if (xmlHttp.readyState==4)
	{ 		
		document.getElementById("divscreensaver").innerHTML=xmlHttp.responseText;		
	}
}
function stateChanged3() 
{ 	
	if (xmlHttp.readyState==4)
	{ 		
		document.getElementById("divdownloads").innerHTML=xmlHttp.responseText;		
	}
}
	
function GetXmlHttpObject()
	{
	var xmlHttp=null;
	try
	  {
	  // Firefox, Opera 8.0+, Safari
	  xmlHttp=new XMLHttpRequest();
	  }
	catch (e)
	  {
	  // Internet Explorer
	  try
		{
		xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
		}
	  catch (e)
		{
		xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
		}
	  }
	return xmlHttp;
}
