function open_new(target, name) {
	var width;
	var height;
	var top;
	var left;
	switch(name) {
		case "my_credit":
			width = 650;
			height = 720;
			top=10;
			left=10;
		break;
		case "no_credit":
			width = 680;
			height = 320;
			top=10;
			left=10;
		break;
		case "edit_profile":
			width = 550;
			height = 720;
			top=10;
			left=10;
		break;
		case "browse":
			width = 890;
			height = 720;
			top=275;
			left=10;
		break;
		case "msg_popup":
			width = 800;
			height = 250;
			top=150;
			left=150;		
		break;		
		default:
			width = 920;
			height = 720;
			top=10;
			left=10;
		break;
		case "loginPopup":
			width = 580;
			height = 720;
			top=10;
			left=10;
		break;
		case "premium":
			width = 830;
			height = 700;
			top=20;
			left=20;
		break;
		case "inscrits":
			width = 680;
			height = 770;
			top=0;
		break;
		case "video":
			width = 670;
			height = 560;
			top=10;
		break;
		case "bigvideo":
			width = 840;
			height = 680;
			top=10;
		break;
			case "profil_membre":
			width = 800;
			height = 780;
			top=10;
		break;
		case "profil_membre2":
			width = 800;
			height = 780;
			top=10;
		break;
		case "show":
			width = 600;
			height = 450;
			top=10;
		break;
		case "cameras_publiques":
			width = 820;
			height = 800;
			top=10;
		break;
		case "messages_cadeaux":
			width = 680;
			height = 500;
			top=0;
		break;
		case "messages_cadeaux2":
			width = 680;
			height = 800;
			top=0;
		break;
		case "messages_cadeaux3":
			width = 830;
			height = 830;
			top=0;
		break;
		case "messages_cadeaux4":
			width = 800;
			height = 660;
			top=20;
			left=20;
		break;
		case "online":
			width = 680;
			height = 800;
			top=0;
		break;
		case "info_cadeaux":
			width = 780;
			height = 680;
			top=10;
		break;
		case "browse":
			width = 890;
			height = 720;
			top=275;
		break;
		case "loginPopup":
			width = 580;
			height = 720;
			top=10;
		break;
		490,555
		case "audiotel":
			width = 490;
			height = 580;
			top=20;
			left=20;
		break;
	}
	window.open(target, name, 'top='+top+',left='+left+',width=' + width + ',height=' + height + ',location=no,menubar=no,resizable=yes,scrollbars=yes,status=no,toolbar=no'); 
	return false;
}
function showPicture(img_filename, img_width, img_height) {
	if (!img_width)	
		img_width = '790';
	if (!img_width.match(/^[\d]*$/))
		img_width = '790';
	if (!img_height)
		img_height = '500';
	if (!img_height.match(/^[\d]*$/))
		img_height = '500';
	window.open('picture.php?img='+img_filename, null, 'top=10,left=10,width='+img_width+',height='+img_height+',location=no,menubar=no,resizable=auto,scrollbars=yes,status=no,toolbar=no'); 
//	return false;
}

function open_profile(user_id)
{
	url = 'user_view_profile.php?uid=' + user_id;
	window.open(url, "profil_membre", 'top=10,left=10,width=' + 790 + ',height=' + 720 + ',location=no,menubar=no,resizable=yes,scrollbars=yes,status=no,toolbar=no')
}

function open_LiveShow()
{
	url = 'liveshow.php';
	window.open(url, "cameras_publiques",'top=10,left=10' )
}
function premium2()
{
	url = 'premium.php';
	window.open(url, "premium",'top=20,left=20,width=' + 800 + ',height=' + 700 + ',location=no,menubar=no,resizable=no,scrollbars=no,status=no,toolbar=no')
}
function premium()
{	//window.open("premium.php", "messages_cadeaux", "width=800, height=700,location=no,menubar=no,resizable=yes,scrollbars=yes,status=no,toolbar=no"); 	
	window.open("gift_buy_points.php?mod=cc", "messages_cadeaux", "width=680, height=700,location=no,menubar=no,resizable=yes,scrollbars=yes,status=no,toolbar=no"); 			
}
function sendGift(gid, uname)
{
	url = 'user_gift_offer.php?gid=' + gid + '&uname=' + uname;
	window.open(url, "messages_cadeaux",  "width=680, height=620,location=no,menubar=no,resizable=yes,scrollbars=yes,status=no,toolbar=no");
	}
function givePresent(girl, gift_id)
{
	url = 'gift_salon.php?broadcaster_name=' + girl + '&gift_id=' + gift_id;
	window.open(url, "messages_cadeaux","top=50,left=50,width=680, height=620,location=no,menubar=no,resizable=yes,scrollbars=yes,status=no,toolbar=no");
}
function nosendGif()
{
	window.open("gift_no_points.php");
}

function open_credit()
{
	window.open("nocredit.php");
}

function view_credit()
{
window.open("products.php?type=cc","messages_cadeaux4", 'top=10,left=10,width=' + 800 + ',height=' + 680 + ',location=no,menubar=no,resizable=yes,scrollbars=yes,status=no,toolbar=no');
}

function buy_credit()
{
	window.open("user_no_credit.php",'blank', 'top=300,left=350,width=' + 420 + ',height=' + 250 + ',location=no,menubar=no,resizable=no,scrollbars=no,status=no,toolbar=no');
}

function op_openmessages(uid)
{
	if (uid > 0)
	{
		window.open("message_received.php?uid=" + uid, "messages", 'top=10,left=10,width=' + 790 + ',height=' + 720 + ',location=no,menubar=no,resizable=yes,scrollbars=yes,status=no,toolbar=no'); 
	}
}

function op_opengifts_salon(broadcaster)
{
	if (broadcaster != "" )
	{
		window.open("gift_inbox.php?broadcaster=" + broadcaster, "messages_cadeaux", 'top=10,left=10,width=' + 790 + ',height=' + 720 + ',location=no,menubar=no,resizable=yes,scrollbars=yes,status=no,toolbar=no'); 		
	}
}

function op_opengifts(uid)
{
	if (uid > 0)
	{
		window.open("gift_inbox.php?uid=" + uid, "messages_cadeaux", 'top=10,left=10,width=' + 790 + ',height=' + 720 + ',location=no,menubar=no,resizable=yes,scrollbars=yes,status=no,toolbar=no'); 		
	}
}

function infoCadeaux()
{
	window.open("gift_buy_points.php?mod=cc", "messages_cadeaux", "width=680, height=700,location=no,menubar=no,resizable=yes,scrollbars=yes,status=no,toolbar=no"); 		
}

function send_flower(name)
{
	window.open("gift_salon.php?hostesse=" + name, "messages_cadeaux", "width=680, height=700,location=no,menubar=no,resizable=yes,scrollbars=yes,status=no,toolbar=no"); 		
}

function maxLength(form_el, param) {
	if(form_el.value.length > param)
	{
		form_el.focus(); 
		return false;
	}
	return true;
}

function minLength(form_el, param) {
	if(form_el.value.length < Integer.parseInt(param)) 
	{
		form_el.focus(); 
		return false;
	}
	return true;
}

function equalLength(form_el, param) {
	if(form_el.value.length == Integer.parseInt(param)) 
		return true;
	else
	{
		form_el.focus(); 
		return false;
	}		
}

function equalValues(form_el1, form_el2) {
	if(form_el1.value != form_el2.value)
	{
		form_el2.focus();
		return false;
	}
	return true;
}
function lengthRestriction(form_el, min, max) {
	if(form_el.value.length >= min && form_el.value.length <= max){
		return true;
	}else{
		alert("Please enter between " +min+ " and " +max+ " characters");
		form_el.focus();
		return false;
	}
}

function emptyElem(form_el) {
	if(form_el.value.length == 0) 
	{
		form_el.focus();
		return true;
	}
	return false;
}

function isEmail(form_el) {
	var reg = /^[\w\-\.\+]+\@[a-zA-Z0-9\.\-]+\.[a-zA-z0-9]{2,4}$/;
	if(form_el.value.match(reg))
		return true;
	else
	{
		form_el.focus();
		return false;
	}
}

function isUrl(form_el) {
    var reg = /^((http|https|ftp):\/\/)?(([A-Z0-9][A-Z0-9_-]*)(\.[A-Z0-9][A-Z0-9_-]*)+)(:(\d+))?/i; 
	if(form_el.value.match(reg))
		return true;
	else
	{
		form_el.focus();
		return false;
	}
}

function isText(form_el) {
	var reg = /^[a-zA-Z]+$/;
	if(form_el.value.match(reg))
		return true;
	else
	{
		form_el.focus();
		return false;
	}
}

function isAlphanumeric(form_el) {
	var reg = /^[0-9a-zA-Z]+$/;
	if(form_el.value.match(reg))
		return true;
	else
	{
		form_el.focus();
		return false;
	}
}

function isName(form_el) {
	var reg = "^[a-z]([a-z0-9 \-\_\.\|])+";
	if(form_el.value.match(reg))
		return true;
	else
	{
		form_el.focus();
		return false;
	}
}

function isPhone(form_el) {
	var reg = "^([0-9])([0-9\.\-])+([0-9])";
	if(form_el.value.match(reg))
		return true;
	else
	{
		form_el.focus();
		return false;
	}
}