function selectCategory()
{	

	var catId=document.getElementById('catId').value;
	var subcatId=document.getElementById('subcatId').value;
	var aa=document.getElementById('selectcat');
	if(catId!="")
	{
	aa.value=catId;
	}
	else
	{
	aa.value=0;
	}
}



function addfav(a,uid,addpath,rempath,imgpath,divid)
{
  var page=document.getElementById('hidPage').value;
	 		
	if(uid==0)
		{
			
			document.location=root+'&mname='+a+'&uid='+uid+'&page='+page;
		}
	else
		{		
		
		  var url =addpath;
		  var pars = 'mname='+a+'&uid='+uid;
		
		var myAjax = new Ajax.Request(
		url, 
		{
		method: 'get', 
		parameters: pars, 
		onSuccess: showResponse,
		onFailure: reportError
		}
		);
	 document.getElementById(divid).innerHTML="";
 	 document.getElementById(divid).innerHTML="<img src='"+imgpath+"/alertadd.jpg' border=0 style='cursor:hand; color:#FF0000;' onClick=removefav('"+a+"','"+uid+"','"+addpath+"','"+rempath+"','"+imgpath+"','"+divid+"');>&nbsp;&nbsp;</img>";
	}
}

function removefav(a,uid,addpath,rempath,imgpath,divid)
{
	var page=document.getElementById('hidPage').value;
			
if(uid==0)
{
   document.location.href(root+'&mname='+a+'&uid='+uid+'&page='+page);
}
else
{
var url = rempath;
var pars = 'mname='+a+'&uid='+uid+'&page='+page;
var myAjax = new Ajax.Request(
url, 
{
method: 'get', 
parameters: pars, 
onSuccess: showResponse,
onFailure: reportError
});
}
		document.getElementById(divid).innerHTML="";
		document.getElementById(divid).innerHTML="<img src='"+imgpath+"/alertremove.jpg' border=0 style='cursor:hand; color:#FF0000;' onClick=alertadd('"+a+"','"+uid+"','"+addpath+"','"+rempath+"','"+imgpath+"','"+divid+"');>&nbsp;&nbsp;</img>";
}

function removefavM(a,uid,addpath,remroot,imgpath,divid)
{

	var page=document.getElementById('hidPage').value;
			
if(uid==0)
{
   document.location.href(remroot+'&mname='+a+'&uid='+uid+'&page='+page);
}
else
{
var url = remroot;
var pars = 'mname='+a+'&uid='+uid+'&page='+page;
var myAjax = new Ajax.Request(
url, 
{
method: 'get', 
parameters: pars, 
onSuccess: showResponse,
onFailure: reportError
});
}	
		document.getElementById('favspan').innerHTML="<a href='#' style='color:#FF0000;' onClick=addfavM('"+a+"','"+uid+"','"+addpath+"','"+remroot+"','"+imgpath+"','"+divid+"')>Add To Favorites&nbsp;</a>";
		document.getElementById(divid).innerHTML="";
		document.getElementById(divid).innerHTML="<img src='"+imgpath+"/alertremove.jpg' border=0 style='cursor:hand; color:#FF0000;' onClick=addfavM('"+a+"','"+uid+"','"+addpath+"','"+remroot+"','"+imgpath+"','"+divid+"');>&nbsp;&nbsp;</img>";
}

function addfavM(a,uid,addpath,remroot,imgpath,divid)
{
	
     var page=document.getElementById('hidPage').value;
		
	if(uid==0)
		{
			
			document.location=addpath+'&mname='+a+'&uid='+uid+'&page='+page;
		}
	else
		{	
		
		var url =addpath;
		var pars = 'mname='+a+'&uid='+uid;
		
		var myAjax = new Ajax.Request(
		url, 
		{
		method: 'get', 
		parameters: pars, 
		onSuccess: showResponse,
		onFailure: reportError		
		}
		);

		document.getElementById('favspan').innerHTML="<a href='#' style='color:#FF0000;' onClick=removefavM('"+a+"','"+uid+"','"+addpath+"','"+remroot+"','"+imgpath+"','"+divid+"')>Already A Favorite</a>";
	  document.getElementById(divid).innerHTML="";
    document.getElementById(divid).innerHTML="<img src='"+imgpath+"/alertadd.jpg' border=0 style='cursor:hand; color:#FF0000;' onClick=removefavM('"+a+"','"+uid+"','"+addpath+"','"+remroot+"','"+imgpath+"','"+divid+"');>&nbsp;&nbsp;</img>";
	}
}

function addfavmodel(a,uid,addfavpath,remfavroot,imgpath,divid,tpl)
{
var category=document.getElementById('category').value;	
var subcat=document.getElementById('subcat').value;	
	
if(uid==0 || uid=='')
{
	document.location.href=addfavpath+'&mname='+a+'&uid='+uid+'&category='+category+'&subcat='+subcat;
}
	else
		{			
		var url =addfavpath;
		var pars = 'mname='+a+'&uid='+uid;		
		
		var myAjax = new Ajax.Request(
		url, 
		{
		method: 'get', 
		parameters: pars, 
		onSuccess: showResponse,
		onFailure: reportError
		
		}
		);
	}
if(uid!=0)
{	
if(tpl=="top")
{
document.getElementById(divid).innerHTML="<img src='"+imgpath+"/topmodeladdfav.jpg' onClick=removefavmodel('"+a+"','"+uid+"','"+addfavpath+"','"+remfavroot+"','"+imgpath+"','"+divid+"','"+tpl+"');>";
}
else
{
document.getElementById(divid).innerHTML="<img src='"+imgpath+"/alertadd.jpg' onClick=removefavmodel('"+a+"','"+uid+"','"+addfavpath+"','"+remfavroot+"','"+imgpath+"','"+divid+"','"+tpl+"');>";	
}
}
}

function removefavmodel(a,uid,addfavpath,remfavroot,imgpath,divid,tpl)
{
var category=document.getElementById('category').value;	
var subcat=document.getElementById('subcat').value;	

if(uid==0)
{
document.location.href=remfavroot+'&mname='+a+'&uid='+uid+'&category='+category+'&subcat='+subcat;
}
else
{
var url = remfavroot;
var pars = 'mname='+a+'&uid='+uid;
var myAjax = new Ajax.Request(
url, 
{
method: 'get', 
parameters: pars, 
onSuccess: showResponse,
onFailure: reportError
});
}
document.getElementById(divid).innerHTML="";
if(tpl=="top")
{
document.getElementById(divid).innerHTML="<img src='"+imgpath+"/topmodelremovefav.jpg' onClick=addfavmodel('"+a+"','"+uid+"','"+addfavpath+"','"+remfavroot+"','"+imgpath+"','"+divid+"','"+tpl+"');>";
}
else
{
document.getElementById(divid).innerHTML="<img src='"+imgpath+"/alertremove.jpg' onClick=addfavmodel('"+a+"','"+uid+"','"+addfavpath+"','"+remfavroot+"','"+imgpath+"','"+divid+"','"+tpl+"');>";	
}
}

function removealertperformer(a,uid,addpath,rempath,imgpath,divid,mid)
{
	var page=document.getElementById('hidPage').value;
if(uid==0)
{
document.location.href(rempath+'&mname='+a+'&uid='+uid+'&page='+page);
}
else
{
var url = rempath;
var pars = 'mname='+a+'&uid='+uid+'&mid='+mid;
var myAjax = new Ajax.Request(
url, 
{
method: 'get', 
parameters: pars, 
onSuccess: showResponse,
onFailure: reportError
});
}
document.getElementById(divid).innerHTML="";
document.getElementById(divid).innerHTML="<img src='"+imgpath+"/alertremove.jpg' style='cursor:pointer;' onClick=addalertperformer('"+a+"','"+uid+"','"+addpath+"','"+rempath+"','"+imgpath+"','"+divid+"','"+mid+"');>";
}

function addalertperformer(a,uid,addpath,rempath,imgpath,divid,mid)
{
  var page=document.getElementById('hidPage').value;
	if(uid==0)
		{
		  document.location=addpath+'&mname='+a+'&uid='+uid+'&page='+page;
		}
	else
		{			
		var url =addpath;
		var pars = 'mname='+a+'&uid='+uid+'&mid='+mid;		
		
		var myAjax = new Ajax.Request(
		url, 
		{
		method:'get', 
		parameters: pars, 
		onSuccess: showResponse,
		onFailure: reportError		
		}
		);
	}

if(uid!=0)
{
document.getElementById(divid).innerHTML="";
document.getElementById(divid).innerHTML="<img src='"+imgpath+"/alertadd.jpg' style='cursor:pointer' onClick=removealertperformer('"+a+"','"+uid+"','"+addpath+"','"+rempath+"','"+imgpath+"','"+divid+"','"+mid+"');>";
}
}

function showResponse(originalRequest)
{

}

function reportError(request)
{
	
}

