var scrStat = 0;	//卷高状态

//FLASH播放javascript
function getFlash(setWidth,setHeight,setUrl){
	if(parseInt(setHeight)<1){
		setHeight = "100%";	
	}
	if(parseInt(setWidth)<1){
		setWidth = "100%";	
	}
	document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width='+setWidth+' height='+setHeight+'>')
	document.write('<param name="movie" value='+setUrl+'>')
	document.write('<param name="quality" value="high">')
	document.write('<param name="wmode" value="transparent" /> ')
	document.write('<embed src='+setUrl+' quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width='+setWidth+' height='+setHeight+' wmode="transparent"></embed></object>')
}

//ID显示关闭div
function ShowMenu(id){
	var state = $('#'+id).css('display');
	if(state == 'none')
	{
		for(var i=0; i<menuList.length;i++)
		{
			if(menuList[i] != id)
				$('#'+menuList[i]).hide();
		}
		$('#'+id).fadeIn("fast");
	}
	else
		$('#'+id).fadeOut("fast");
}

//ID显示关闭div
function Show(id){
	var state = $('#'+id).css('display');
	if(state == 'none')
		$('#'+id).fadeIn("fast");
	else
		$('#'+id).fadeOut("fast");
}

//JS提交表单
function submit(Id)
{
	document.getElementById(Id).submit();
}

//购物车前置浮层
function BuyLayer(page, act, id)
{
	var quehtml = '';
	var key = $('#color_'+id).val();
	var que = $('#color_'+id+'_'+key).attr('que');

	var state = $('#color_'+id+'_'+key).attr('title');
	if(state == 1)
	{
		MyAlert('Ce produit n\'est pas disponible.');
		return;
	}

	quehtml += 'Quantité: <select name="buy_que" id="buy_que">';

	if(page == '/shop_bulk.php')
	{
		que=100;
		var selnum = parseInt($('#selnum_'+id).val());
	}
	else
	{
		var selnum = 1;
	}
	for(var i=selnum;i<=que;i=i+selnum)
	{
		quehtml += '<option value="'+i+'">'+i+'</option>';
	}
	quehtml += '</select>';
	if($('#color_'+id+'_'+key).attr('text') != '')
	{
		quehtml += '<br/><br/>Référence: '+$('#color_'+id+'_'+key).attr('text');
	}

	$('#buy_layer_tt').html($('#tt_'+id).html());
	$('#buy_layer_que').html(quehtml);

	var buy_layer = document.getElementById('buy_layer');

	var i_height = 0;
	if($('#buy_layer').css('display','') == 'none')
	{
		i_height = 200;
	}
	$('#buy_layer').css('top',getscrollTop()+getclientHeight()-buy_layer.offsetHeight-300-i_height);
	$('#buy_layer').css('left',document.body.scrollLeft+document.body.clientWidth-(document.body.clientWidth/2+150));

	$('#buy_layer').css('display','');

	document.getElementById('buy_btn').onclick = function(){
		EditShop(page, act, id);
		$('#buy_layer').css('display','none');
	};
}




//AJAX修改购物车
function EditShop(page, act, addid)
{
	var key = $('#color_'+addid).val();
	var state = $('#color_'+addid+'_'+key).attr('title');
	if(state == 1)
	{
		MyAlert('Ce produit n\'est pas disponible.');
		return;
	}
	if(page == '/shop.php' && state == 2)
	{
		MyAlert('Ce produit n\'est pas disponible.');
		return;
	}
	var color = ($('#color_'+addid).val() != undefined) ? $('#color_'+addid).val() : '';
	var buy_que = ($('#buy_que').val() != undefined) ? $('#buy_que').val() : 1;

	$.get(page,{act:act,id:addid,color:color,que:buy_que,chk:GetCheckTime()},
		function(data){
			if(act == 'del')
			{
				alert(data);
				$('#row_'+addid).remove();
				ShopChange(0);
			}
			if(act == 'add')
			{
				if($.trim(data) == 'false')
					MyAlert('Ce produit est déjà présent dans votre panier.');
				else
				{
					//MyAlert("Votre sélection a été ajouté au Panier.\nVous pouvez consulter celui ci pour modifier la quantité.");
					$("#ShopLayerIframe").attr("src",$("#ShopLayerIframe").attr("src"));
				}
			}
		});
}

//单页AJAX添加购物车
function PageAddShop(page, act, addid)
{
	var key = $('#color_'+addid).val();
	var state = $('#color_'+addid+'_'+key).attr('title');
	if(state == 1)
	{
		alert('Non disponible !');
		return;
	}
	var color = ($('#color_'+addid).val() != undefined) ? $('#color_'+addid).val() : '';

	$.get(page,{act:act,id:addid,color:color,chk:GetCheckTime()},
		function(data){
			if(act == 'del')
			{
				alert(data);
				$('#row_'+addid).remove();
				ShopChange(0);
			}
			if(act == 'add')
			{
				if($.trim(data) == 'false')
					alert('Ce produit est déjà présent dans votre panier.');
				else
					alert("Votre sélection a été ajouté au Panier.\nVous pouvez consulter celui ci pour modifier la quantité.");
			}
		});
}

//修改购物车价格
function ShopChange(id)
{
	var total = 0;
	var tmpStr;
	var num = $('#tnum').val();
	if(id != 0)
		$('#B_T_'+id).html(parseFloat($('#num_'+id).val()) * parseFloat($('#B_I_'+id).text())+'.00€');

	for(var i=1; i<=num; i++)
	{
		tmpStr = $('#B_T_'+i).text();
		if(tmpStr != '' && tmpStr != undefined)
			total = parseFloat(total) + parseFloat($('#B_T_'+i).text());
	}
	$('#B_T').html(total+'.00');
}

//显示购物车
function ShowShop(url)
{
	if($('#ShopLayer').html() == null)
	{
		$('#RightAD').fadeOut("normal");
		scrStat = getscrollTop();	//初始化卷高为当前高度

		$("body").append('<div id="ShopLayer" style="position:absolute;width:404px; height:0px; background-color:#FFFFFF; z-index: 9; display:none;"><iframe id="ShopLayerIframe" style="position:absolute; z-index: 9;width:400px; height:0px;top:2px;left:2px; overflow-y:hidden;" frameborder=0 frameborder="0" src="'+url+'?act=shop2&chk='+GetCheckTime()+'"></iframe>');

		$('#ShopLayer').fadeIn("normal");
		$('#ShopLayer').css("left",getscrollLeft()+document.body.clientWidth-document.getElementById('ShopLayer').offsetWidth-5);

		//$('#ShopLayer').css("top",getscrollTop()+getclientHeight()-ShopLayer.offsetHeight-111);

		//$('#ShopLayer').css("left",20);
		//$('#ShopLayer').css("top",document.documentElement.scrollTop+50);
		//$('#ShopLayer').fadeIn("normal");
	}
	else
	{
		var state = $('#ShopLayer').css('display');
		if(state == 'none')
		{
			$('#ShopLayer').fadeIn("normal");
			$('#ShopLayer').css("left",document.body.scrollLeft+document.body.clientWidth-ShopLayer.offsetWidth-5);
			$('#ShopLayer').css("top",getscrollTop()+getclientHeight()-ShopLayer.offsetHeight-150);

			//$('#ShopLayer').css("left",20);
			//$('#ShopLayer').css("top",document.documentElement.scrollTop+50);
			//$('#ShopLayer').fadeIn("normal");
		}
		$('#ShopLayer').remove();
	}
}



//定制弹窗
function MyAlert(msg)
{
	if($('#MyAlertDiv').html() == null)
	{
		$("body").append("<div id='MyAlertDiv' style='Z-INDEX:99999; LEFT:0px;POSITION:absolute; TOP:0px;width:408px;height:185px; background:#95CDFD; display:none;border:2px solid #FFFFFF;'><div style='float:right; padding:5px;'><img src='/images/c.jpg' border='0' onclick=\"$('#MyAlertDiv').css('display','none')\" class='pointer' /></div><div style='text-align:center;width:360px;font-size:15px;padding:15px;' id='MyAlertInfo'>"+msg+"</div></div>");

		$('#MyAlertDiv').css('display','');

	}
	else
	{
		$('#MyAlertInfo').html(msg);
	}

	var buy_layer = document.getElementById('MyAlertDiv');

	var i_height = 0;
	if($('#MyAlertDiv').css('display','') == 'none')
	{
		i_height = 200;
	}
	$('#MyAlertDiv').css('top',getscrollTop()+getclientHeight()-buy_layer.offsetHeight-300-i_height);
	$('#MyAlertDiv').css('left',document.body.scrollLeft+document.body.clientWidth-(document.body.clientWidth/2+150));

	$('#MyAlertDiv').css('display','');
}


//关闭购物车
function ClosePShop()
{
	$('#RightAD').fadeIn("normal");
	$('#ShopLayer').fadeOut("normal");
	$('#ShopLayer').remove();
}

//关闭购物车
function CloseShop()
{
	parent.$('#RightAD').fadeIn("normal");
	parent.$('#ShopLayer').fadeOut("normal");
	parent.$('#ShopLayer').remove();
}

//修改购物车内容数量与及价格
function ChangeItemNum(id, name, page, pageItem)
{
	window.location.href=page+'?act=chnum&id='+id+'&num='+$('#'+name).val()+'&rpage='+pageItem;
}

//修改购物车内容数量与及价格
function ChangePost(id, name, page)
{
	window.location.href=page+'?act=chpost&id='+id+'&num='+$('#'+name).val();
}

//切换图片
function ChangeImg(id)
{
	var key = $('#color_'+id).val();
	$('#img_'+id).attr('src', $('#color_'+id+'_'+key).attr('lang'));
	$('#img_a_'+id).attr('href', $('#color_'+id+'_'+key).attr('lang'));

	$('#state_'+id).attr('src', "../images/state_"+$('#color_'+id+'_'+key).attr('title')+".gif");
	$('#que_'+id).html($('#color_'+id+'_'+key).attr('que'));
}

//切换批发图片
function ChangeBulkImg(id)
{
	var key = $('#color_'+id).val();
	$('#img_'+id).attr('src', $('#color_'+id+'_'+key).attr('lang'));
	$('#img_a_'+id).attr('href', $('#color_'+id+'_'+key).attr('lang'));

	$('#state_'+id).attr('src', "../images/bulk_state_"+$('#color_'+id+'_'+key).attr('title')+".gif");
	$('#que_'+id).html($('#color_'+id+'_'+key).attr('que'));
}

function ShowDiv(id, type)
{
	if(type == 'in')
	{
		$('#'+id).fadeIn("normal");
	}
	else
	{
		$('#'+id).fadeOut("normal");
	}
}

//关闭显示浮层，并定位至页面中间
function ShowLayer(id)
{
	var state = $('#'+id).css('display');
	if(state == 'none')
	{
		$('#'+id).css("left",document.documentElement.clientWidth/2-350);
		$('#'+id).css("top",document.documentElement.scrollTop+150);
		$('#'+id).fadeIn("normal");
	}
	else
		$('#'+id).fadeOut("normal");
}

//显示订单详细浮层
function ShowLayer_Sale(addid)
{
	$.get("item.php",{id:addid},
		function(data){
			if(data == 'false')
				return;
			else
				$("#LayerContent").html(data);
		});
	ShowLayer('InfoLayer');
}

//获取时间数
function GetCheckTime()
{
	var d= new Date();
	return d.getFullYear().toString()+d.getMonth()+d.getDate()+d.getHours()+d.getMinutes()+d.getSeconds();
}

//同步订单内容至发票
function RsycDDInfo()
{
	$('#f_nom').val($('#nom').val());
	$('#f_pernom').val($('#pernom').val());
	$('#f_societe').val($('#societe').val());
	$('#f_address').val($('#address').val());
	$('#f_post').val($('#post').val());
	$('#f_ville').val($('#ville').val());
	$('#f_pay').val($('#pay_'+$('#pay').val()).attr('lang'));
}

//弹出游戏搜索框
function SearchGame(type)
{
	if($("#keyWord2").val().length < 3)
	{
		alert('Veuillez saisir au moins 3 caractères.');
		return;
	}
	var url = '/member/zone.php?act=search&keyWord='+$('#keyWord2').val()+'&swaptype='+type;
	ShowWindow(url,500,680,80,300);
}

//添加游戏
function AddSwapItem(addid)
{
	var numVal = $("#num_"+addid).val();
	var etatVal = $("input[@name=etat_"+addid+"][@checked]").val();
	var tmpStatusVal = $("input[@name=status_"+addid+"][@checked]");
	var swaptypeVal = $("#swaptype").val();
	var statusVal = '';

	for(var i=0;i<tmpStatusVal.length;i++)		//组合多选
	{
		statusVal += '<br>'+tmpStatusVal[i].value;
	}
	statusVal = statusVal.substr(4,statusVal.length);

	$.get('/member/zone.php',{act:'add_me',id:addid,etat:etatVal,status:statusVal,num:numVal,swaptype:swaptypeVal,chk:GetCheckTime()},
		function(data){
			alert($.trim(data));
			window.opener.location.href=window.opener.location.href;
			window.close();
		});
}

//修改
function ChgSwapItem(addid)
{
	var numVal = $("#num_"+addid).text();
	var etatVal = $("#etat_"+addid).text();
	var statusVal = $("#status_"+addid).text();
	var priceVal = parseFloat($("#price_"+addid).text());
	var tmpText;

	$("#num_"+addid).html("<input type='text' name='numVal_"+addid+"' id='numVal_"+addid+"' value='"+numVal+"' class='inputBox' maxlength='2' style='width:20px;'/>");
	$("#price_"+addid).html("<input type='text' name='priceVal_"+addid+"' id='priceVal_"+addid+"' value='"+priceVal+"' class='inputBox1' maxlength='4'/>");

	tmpText="<select name='etatVal_"+addid+"' id='etatVal_"+addid+"'>";
	if(etatVal == 'Neuf')
		tmpText+="<option value='Neuf' selected>Neuf</option>";
	else
		tmpText+="<option value='Neuf'>Neuf</option>";

	if(etatVal == 'Occ')
		tmpText+="<option value='Occ' selected>Occ</option>";
	else
		tmpText+="<option value='Occ'>Occ</option>";
	tmpText+="</select>";
	$("#etat_"+addid).html(tmpText);

	tmpText="";
	if(statusVal.indexOf('Vend') == -1)
		tmpText+="<input type='checkbox' name='statusVal_"+addid+"' value='Vend' />Vend<br/>";
	else
		tmpText+="<input type='checkbox' name='statusVal_"+addid+"' value='Vend' checked />Vend<br/>";

	if(statusVal.indexOf('Echange') == -1)
		tmpText+="<input type='checkbox' name='statusVal_"+addid+"' value='Echange' />Echange<br/>";
	else
		tmpText+="<input type='checkbox' name='statusVal_"+addid+"' value='Echange' checked />Echange<br/>";

	if(statusVal.indexOf('Pret') == -1)
		tmpText+="<input type='checkbox' name='statusVal_"+addid+"' value='Pret' />Pret<br/>";
	else
		tmpText+="<input type='checkbox' name='statusVal_"+addid+"' value='Pret' checked />Pret<br/>";

	$("#status_"+addid).html(tmpText);
	$("#action_"+addid).css('display','none');
	$("#action1_"+addid).css('display','');
}

//修改
function ChgSwapItemForAchat(addid)
{
	var numVal = $("#num_"+addid).text();
	var etatVal = $("#etat_"+addid).text();
	var statusVal = $("#status_"+addid).text();
	var priceVal = parseFloat($("#price_"+addid).text());
	var tmpText;

	$("#num_"+addid).html("<input type='text' name='numVal_"+addid+"' id='numVal_"+addid+"' value='"+numVal+"' class='inputBox' maxlength='2' style='width:20px;'/>");
	$("#price_"+addid).html("<input type='text' name='priceVal_"+addid+"' id='priceVal_"+addid+"' value='"+priceVal+"' class='inputBox1' maxlength='4'/>");

	tmpText="<select name='etatVal_"+addid+"' id='etatVal_"+addid+"'>";
	if(etatVal == 'Neuf')
		tmpText+="<option value='Neuf' selected>Neuf</option>";
	else
		tmpText+="<option value='Neuf'>Neuf</option>";

	if(etatVal == 'Occ')
		tmpText+="<option value='Occ' selected>Occ</option>";
	else
		tmpText+="<option value='Occ'>Occ</option>";
	tmpText+="</select>";
	$("#etat_"+addid).html(tmpText);

	tmpText="";
	if(statusVal.indexOf('Achat') == -1)
		tmpText+="<input type='checkbox' name='statusVal_"+addid+"' value='Achat' />Achat<br/>";
	else
		tmpText+="<input type='checkbox' name='statusVal_"+addid+"' value='Achat' checked />Achat<br/>";

	if(statusVal.indexOf('Echange') == -1)
		tmpText+="<input type='checkbox' name='statusVal_"+addid+"' value='Echange' />Echange<br/>";
	else
		tmpText+="<input type='checkbox' name='statusVal_"+addid+"' value='Echange' checked />Echange<br/>";

	if(statusVal.indexOf('Pret') == -1)
		tmpText+="<input type='checkbox' name='statusVal_"+addid+"' value='Pret' />Pret<br/>";
	else
		tmpText+="<input type='checkbox' name='statusVal_"+addid+"' value='Pret' checked />Pret<br/>";

	$("#status_"+addid).html(tmpText);
	$("#action_"+addid).css('display','none');
	$("#action1_"+addid).css('display','');
}

//修改保存
function SaveSwapItem(addid, url)
{
	var numVal = $("#numVal_"+addid).val();
	var etatVal = $("#etatVal_"+addid).val();
	var priceVal = parseFloat($("#priceVal_"+addid).val());

	var tmpStatusVal = $("input[@name=statusVal_"+addid+"][@checked]");
	var statusVal = '';

	for(var i=0;i<tmpStatusVal.length;i++)		//组合多选
	{
		statusVal += '<br>'+tmpStatusVal[i].value;
	}
	statusVal = statusVal.substr(4,statusVal.length);

	$.get(url,{act:'edit',id:addid,etat:etatVal,status:statusVal,num:numVal,price:priceVal,chk:GetCheckTime()},
		function(data){
			$("#num_"+addid).html(numVal);
			$("#etat_"+addid).html(etatVal);
			$("#price_"+addid).html(priceVal+'€');
			$("#status_"+addid).html(statusVal);
			$("#action_"+addid).css('display','');
			$("#action1_"+addid).css('display','none');
			alert(data);
	});
}

//删除
function DelSwapItem(addid)
{
	$.get('/member/mygome.php',{act:'del',id:addid,chk:GetCheckTime()},
		function(data){
			alert(data);
			$('#lay_'+addid).remove();
	});
}

//ajax alert返回结果
function AlertGet(url)
{
	$.get(url,function(data){alert(data);});
}

function ShowWindow(url, height, width, top, left)
{
	window.open(url, 'newwindow', 'height='+height+', width='+width+', top='+top+', left='+left+', toolbar=no, menubar=no, scrollbars=yes, resizable=no,location=no, status=no');
}

//自动设置高度
function SetMidTableHeight()
{
	if(parent.document.getElementById('ShopLayer'))
	{
		if(parseInt(getscrollHeight()+5) > 600)
		{
			parent.document.getElementById('ShopLayer').style.height='604px';
			parent.document.getElementById('ShopLayerIframe').style.height='600px';
		}
		else
		{
			parent.document.getElementById('ShopLayer').style.height=parseInt(getscrollHeight()+5)+4+'px';
			parent.document.getElementById('ShopLayerIframe').style.height=parseInt(getscrollHeight()+5)+'px';
		}

		parent.$('#ShopLayer').css("top", getParentScrollTop()+getParentClientHeight()-parent.document.getElementById('ShopLayer').offsetHeight-5);
	}
}

//取滚动定义
function getParentScrollTop()
{
	var Temp=parent.document.documentElement.scrollTop;
	if(Temp>0)
	{
		return Temp;
	}
	else
	{
		return parent.document.body.scrollTop;
	}
}
function getParentClientHeight()
{
	var Temp=parent.document.documentElement.clientHeight;
	if(Temp>0)
	{
		return Temp;
	}
	else
	{
		return parent.document.body.clientHeight;
	}
}

function getscrollHeight()
{
	var Temp=document.documentElement.scrollHeight;
	if(Temp>0)
	{
		return Temp;
	}
	else
	{
		return document.body.scrollHeight;
	}
}

//取滚动定义
function getscrollTop()
{
	var Temp=document.documentElement.scrollTop;
	if(Temp>0)
	{
		return Temp;
	}
	else
	{
		return document.body.scrollTop;
	}
}
function getscrollLeft()
{
	var Temp=document.documentElement.scrollLeft;
	if(Temp>0)
	{
		return Temp;
	}
	else
	{
		return document.body.scrollLeft;
	}
}
function getclientHeight()
{
	var Temp=document.documentElement.clientHeight;
	if(Temp>0)
	{
		return Temp;
	}
	else
	{
		return document.body.clientHeight;
	}
}

//logout
function Logout(sid)
{
	$.get("/logout.php?mode=&",{mode:"logout",sid:sid,chk:GetCheckTime()},
		function(data){
			var url = window.location.href;
			if(url.indexOf('/member/') == -1)
				window.location.reload();
			else
				window.location.href="/member/index.php";
		});
}

function ArtPage(urlVal,pageVal,sortidVal)
{
	$.get(urlVal,{sortid:sortidVal,page:pageVal,chk:GetCheckTime()},
		function(data){
			$('#list_'+sortidVal).html(data);
		});
}

function CheckBulkDD()
{
	if($('#nom').val() == '')
	{
		alert("Vous avez oublié de remplir votre : Nom");
		$('#nom').focus();
		return false;
	}
	if($('#pernom').val() == '')
	{
		alert("Vous avez oublié de remplir votre : Prénom");
		$('#pernom').focus();
		return false;
	}
	if($('#address').val() == '')
	{
		alert("Vous avez oublié de remplir votre : Adresse");
		$('#address').focus();
		return false;
	}
	if($('#post').val() == '')
	{
		alert("Vous avez oublié de remplir votre : Code Postal");
		$('#post').focus();
		return false;
	}
	if($('#ville').val() == '')
	{
		alert("Vous avez oublié de remplir votre : Ville");
		$('#ville').focus();
		return false;
	}

	if($('#fixe').val() == '' && $('#phone').val() == '')
	{
		alert("Vous avez oublié de remplir votre : Téléphone.\nMerci de préciser au moins un numéro de téléphone fixe ou portable.\nCelui-ci sera mentionné sur le colis à l'intention du livreur (en cas de besoin).");
		$('#fixe').focus();
		return false;
	}

	if($('#email').val() != undefined && $('#email').val() == '')
	{
		alert("Vous avez oublié de remplir votre : Email");
		$('#email').focus();
		return false;
	}

	if($('#f_nom').val() == '')
	{
		alert("Vous avez oublié de remplir votre : Nom");
		$('#f_nom').focus();
		return false;
	}
	if($('#f_pernom').val() == '')
	{
		alert("Vous avez oublié de remplir votre : Prénom");
		$('#f_pernom').focus();
		return false;
	}
	if($('#f_address').val() == '')
	{
		alert("Vous avez oublié de remplir votre : Adresse");
		$('#f_address').focus();
		return false;
	}
	if($('#f_post').val() == '')
	{
		alert("Vous avez oublié de remplir votre : Code Postal");
		$('#f_post').focus();
		return false;
	}
	if($('#f_ville').val() == '')
	{
		alert("Vous avez oublié de remplir votre : Ville");
		$('#f_ville').focus();
		return false;
	}
	if($('#f_pay').val() == '')
	{
		alert("Vous avez oublié de remplir votre : Pays");
		$('#f_pay').focus();
		return false;
	}

	submit('ddForm');
}

function CheckDD()
{
	if($('#nom').val() == '')
	{
		alert("Vous avez oublié de remplir votre : Nom");
		$('#nom').focus();
		return false;
	}
	if($('#pernom').val() == '')
	{
		alert("Vous avez oublié de remplir votre : Prénom");
		$('#pernom').focus();
		return false;
	}
	if($('#address').val() == '')
	{
		alert("Vous avez oublié de remplir votre : Adresse");
		$('#address').focus();
		return false;
	}
	if($('#post').val() == '')
	{
		alert("Vous avez oublié de remplir votre : Code Postal");
		$('#post').focus();
		return false;
	}
	if($('#ville').val() == '')
	{
		alert("Vous avez oublié de remplir votre : Ville");
		$('#ville').focus();
		return false;
	}

	if($('#email').val() != undefined && $('#email').val() == '')
	{
		alert("Vous avez oublié de remplir votre : Email");
		$('#email').focus();
		return false;
	}

	if($('#f_nom').val() == '')
	{
		alert("Vous avez oublié de remplir votre : Nom");
		$('#f_nom').focus();
		return false;
	}
	if($('#f_pernom').val() == '')
	{
		alert("Vous avez oublié de remplir votre : Prénom");
		$('#f_pernom').focus();
		return false;
	}
	if($('#f_address').val() == '')
	{
		alert("Vous avez oublié de remplir votre : Adresse");
		$('#f_address').focus();
		return false;
	}
	if($('#f_post').val() == '')
	{
		alert("Vous avez oublié de remplir votre : Code Postal");
		$('#f_post').focus();
		return false;
	}
	if($('#f_ville').val() == '')
	{
		alert("Vous avez oublié de remplir votre : Ville");
		$('#f_ville').focus();
		return false;
	}
	if($('#f_pay').val() == '')
	{
		alert("Vous avez oublié de remplir votre : Pays");
		$('#f_pay').focus();
		return false;
	}

	submit('ddForm');
}

function checkKeyWord(obj){
	var info = obj.value;
	if(info==" Tapez votre recherche"){
		obj.value = "";
	}
}

function ChangePayType(payType)
{
	window.location.href='rtir.php?act=chpaytype&payType='+payType;
}

function GetLoginStatus()
{
	var status = $('#loginStatus').val();
	if(status == 'yes')
	{
		return true;
	}
	else
	{
		return false;
	}
}

function CheckDD1(type)
{
	if(GetLoginStatus())
	{
		window.parent.location.href = type+'/dd.php';
		window.close();
	}
	else
	{
		ShowWindow('/notice.php',500,680,100,300);
	}
}

function CheckDD2(type)
{
	if(GetLoginStatus())
	{
		if(type == 'sale') type = 'dg_boutique';
		if(type == 'bulk') type = 'dg_grossiste';
		window.opener.parent.location.href = type+'/dd.php';
		window.close();
	}
	else
	{
		window.location.href = '/notice.php';
	}
}

function RetunToLogin()
{
	var url = window.opener.parent.location.href;
	r = url.replace(/#.+/g, "");
	window.opener.parent.location.href = r+'#top';
	window.close();
}

function ZoneSearch()
{
	if($("#keyWord").val().length < 3)
	{
		alert('Veuillez saisir au moins 3 caractères.');
	}
	else
	{
		submit('search');
	}
}

function ChgAttr(id, attr, val)
{
	$('#'+id).attr(attr,val);
}

function ChgClick(id, val)
{
	$('#'+id).click(val);
}
var showS = 0;
var showS1 = 0;
function ShowSmile(s)
{
	if(s == 'in')
	{
		$("#smile").fadeIn("fast");
		showS1 = 1;
	}
	else
	{
		if(showS1 ==1)
		{
			if(showS == 1)
			{
				$("#smile").fadeOut("fast");
				showS = 0;
				showS1 = 0;
			}
			else
			{
				showS++;
			}
		}
	}
}

function SetSmile(val)
{
	var con = '[:'+val+']';
	AddText(con);
	$("#smile").fadeOut("fast");
}

function OpenerLocation(url)
{
	window.opener.location.href=url;
	window.close();
}

function ShowImg(id)
{
	if(document.getElementById('simg'+id).style.display == '')
		document.getElementById('simg'+id).style.display = 'none';
	else
	{
		$("#bimg"+id).attr("src",$("#img_"+id).attr("src"));
		document.getElementById('simg'+id).style.display = '';
	}
}
