function PopUp(url,width,height,resize,top,left,name)
{
	if(!top)
		var top=((screen.height)/2)-(height/2);
	if(!left)
		var left=((screen.width)/2)-(width/2);
	var params='toolbar=0, location=0, directories=0, status=0, scrollbars=0, resizable=0, copyhistory=0, menuBar=0';	
	if(resize==1)
		var params='toolbar=0, location=0, directories=0, status=0, scrollbars=1, resizable=1, copyhistory=0, menuBar=0';
	window.open(url,name,'top='+top+', left='+left+', height='+height+', width='+width+','+params);
}


winpopup=new Array();
tutu=new Array();




function PopUpChat(url,name)
{
	var width=600;
	var height=400;
	var top=((screen.height)/2)-(height/2);
	var left=((screen.width)/2)-(width/2);

	for(var i = 0, l = winpopup.length; i < l; i++)
	{
        if(winpopup[i] == name)
		{
			if(tutu[i].closed)		
			{
				winpopup.splice(i,1);
				tutu.splice(i,1);
			}
		}
    }
	
	if(!winpopup.in_array(name))
	{
    	try
		{		
			winpopup.push(name);
			tutu[tutu.length]=window.open(url,name,"height="+height+",width="+width+",top="+top+",left="+left+",toolbar=0,location=0,directories=0,status=0,scrollbars=1,resizable=1,copyhistory=0,menuBar=0");
		}
		catch (e)
		{ 
			winpopup[winpopup.length] = false;
			return false;
		}
	}
	else
	{
		
		for(var i = 0, l = winpopup.length; i < l; i++)
		{
        	if(winpopup[i] == name)
			{
				tutu[i].blur();
				tutu[i].focus();
				/*
				if (navigator.userAgent.indexOf('Chrome/') > 0)
					tutu[i].blur();
				else
					
*/
			}
	    }
	}
}




function PopUp2(url,width,height,resize,top,left,name)
{
	
	if(!top)
		var top=((screen.height)/2)-(height/2);
	if(!left)
		var left=((screen.width)/2)-(width/2);

	for(var i = 0, l = winpopup.length; i < l; i++)
	{
        if(winpopup[i] == name)
		{
			if(tutu[i].closed)		
			{
				winpopup.splice(i,1);
				tutu.splice(i,1);
			}
		}
    }
	
	if(!winpopup.in_array(name))
	{
    	try
		{		
			winpopup.push(name);
			tutu[tutu.length]=window.open(url,name,"height="+height+",width="+width+",top="+top+",left="+left+",toolbar=0,location=0,directories=0,status=0,scrollbars=1,resizable=1,copyhistory=0,menuBar=0");
		}
		catch (e)
		{ 
			winpopup[winpopup.length] = false;
			return false;
		}
	}
	else
	{
		
		for(var i = 0, l = winpopup.length; i < l; i++)
		{
        	if(winpopup[i] == name)
			{
				tutu[i].blur();
				tutu[i].focus();
				/*
				if (navigator.userAgent.indexOf('Chrome/') > 0)
					tutu[i].blur();
				else
					
*/
			}
	    }
	}
}

Array.prototype.in_array = function(p_val) {
    for(var i = 0, l = this.length; i < l; i++) {
        if(this[i] == p_val) {
            rowid = i;
            return true;
        }
    }
    return false;
}
