// JavaScript Document
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function verifSearch()
	{
	var message='';
	try {
	var zext = document.research.zext.value;
	var materialGroup = document.research.materialGroup.value;
	var weave = document.research.weave.value;
	var design = document.research.design.value;
	var weightCat = document.research.weightCat.value;
	var priceRange = document.research.priceRange.value;
	var bunchNum = document.research.bunchNum.value;
	var materialName = document.research.materialName.value;
	var seasonality = document.research.seasonality.value;
	var colourGroup = document.research.colourGroup.value;
	var bunchName = document.research.bunchName.value;
	var bunchNum = document.research.bunchNum.value;
	var bunchDescr = document.research.bunchDescr.value;
	var bunchDescr2 = document.research.bunchDescr2.value;
	var bunchDescr3 = document.research.bunchDescr3.value;
	var zwool = document.research.ZWOOL_SPECIFICS.value;
	} catch(err) {}
	
	if ((materialGroup == 'WOOL' | materialGroup == 'COTTON' | materialGroup == 'SILK' | materialGroup == 'CASHMERE' | materialGroup == 'POLYESTER' | materialGroup == 'MOHAIR') & document.research.percent[1].checked & weightCat == '' & colourGroup == '' & weave == '' & design == '' & priceRange == '' & materialName == '' & seasonality == '')
		{
		message += "There are too many results, please select more than only Material Group.";
		}
	
	if ((weave == 'WE13' | weave == 'WE9' | weave == 'WE6' | weave == 'WE10' | weave == 'WE5' | weave == 'WE7' | weave == 'WE4' | weave == 'WE11') & weightCat == '' & colourGroup == '' & materialGroup == '' & design == '' & priceRange == '' & materialName == '' & seasonality == '')
		{
		message += "There are too many results, please select more than only Weave.";
		}

	if (weightCat != '' & materialGroup == '' & colourGroup == '' & weave == '' & design == '' & priceRange == '' & materialName == '' & seasonality == '')
		{
		message += "There are too many results, please select more than only Weight Category.";
		}
	if (weightCat == '' & materialGroup == '' & colourGroup == '' & weave == '' & design == '' & priceRange == '' & materialName == '' & seasonality != '')
		{
		message += "There are too many results, please select more than only Seasonality.";
		}
	if (weightCat == '' & materialGroup == '' & colourGroup != '' & weave == '' & design == '' & priceRange == '' & materialName == '' & seasonality == '')
		{
		message += "There are too many results, please select more than only Colour Group.";
		}
	if (weightCat == '' & materialGroup == '' & colourGroup == '' & weave == '' & design == '' & priceRange != '' & materialName == '' & seasonality == '')
		{
		message += "There are too many results, please select more than only Price Range.";
		}
	if (weightCat == '' & materialGroup == '' & colourGroup == '' & weave == '' & design == '' & priceRange == '' & materialName == '' & seasonality == '' & zwool == '')
		{
		message += "There are too many results, you should choose some characteristics";
		}

	if (zext != '' | bunchName != '' | bunchNum != '' | bunchDescr !='' | bunchDescr2 !='' | bunchDescr3 !='')
		{
		message='';
		}

	if (message=='')
		{
		return true;
		}
	else
		{
		// il y a une erreur dans le remplissage du formulaire, on affiche le message
		alert(message);
		return false;
		}
	}

function PopHelp(cat,value, lg)
	{
	//window.open ('../fabricscat/help.php?cat='+cat+'&value='+value+'&lg='+lg, 'HelpHelp', config='height=350, width=450, toolbar=no, menubar=no, scrollbars=no, resizable=no, location=no, directories=no, status=no');
	//jQuery.facebox({ ajax: '../fabricscat/help.php?cat='+cat+'&value='+value+'&lg='+lg },);
	jQuery.facebox(function($) { 
       jQuery.get('../fabricscat/help.php',{cat:cat,value:value,lg:lg}, function(data) { 
       	var dd = data.replace('id=help','id=hh');	
       	jQuery.facebox(dd) 
       })
    })
	}
function PopCond()
	{
	jQuery.facebox(function($) 
	{ 
		jQuery.get('../fabricscat/conditions.php', function(data) {
			var dd = data.replace('id=help','id=hh');	
    		jQuery.facebox(dd);
  		})		
	});	
	//window.open ('../fabricscat/conditions.php', 'HelpHelp', config='height=350, width=450, toolbar=no, menubar=no, scrollbars=no, resizable=no, location=no, directories=no, status=no');
	}

function question() 
{
var d = document.getElementById('question');
if (d.style.display!='block') {
	d.style.display='block';
	document.remarks.message.focus(); 
	}
else {
	d.style.display='none';
	}
}



function montre(id) 
{
var d = document.getElementById('list'+id);
var e = document.getElementById('nav'+id);
var f = document.getElementById('navb'+id);
for (var i = 0; i<=31; i++) 
	{
	if (document.getElementById('list'+i)) 
		{
		document.getElementById('list'+i).style.display='none';
		document.getElementById('nav'+i).style.display='none';
		document.getElementById('navb'+i).style.display='none';
		}
	}
if (d) {
	d.style.display='block';
	e.style.display='block';
	f.style.display='block';
	}
}

function showstep(id)
	{
	var d = document.getElementById('logostep'+id);
	var e = document.getElementById('txtstep'+id);
	if (d.style.display=='none')
		{
		d.style.display='';
		e.style.display='none';
		}
	else
		{
		d.style.display='none';
		e.style.display='';
		}
	}

function montresc(id) 
{
var d = document.getElementById('screen'+id);
for (var i = 0; i<=2; i++) 
	{
	if (document.getElementById('screen'+i)) 
		{
		document.getElementById('screen'+i).style.display='none';
		}
	}
if (d) {
	d.style.display='block';
	}
}

function show(what, id) 
{
var d = document.getElementById(what+id);
for (var i = 0; i<=4; i++) 
	{
	if (document.getElementById(what+i)) 
		{
		document.getElementById(what+i).style.display='none';
		}
	}
if (d) {
	d.style.display='block';
	}
}

function showmenu(what, id) 
{
var d = document.getElementById(what+id);
for (var i = 1; i<=8; i++) 
	{
	if (document.getElementById(what+i)) 
		{
		document.getElementById(what+i).style.display='none';
		}
	}
if (d) {
	d.style.display='block';
	}
}

function hide(what, id) 
{
var d = document.getElementById(what+id);
if (d) {
	d.style.display='none';
	}
}

function showhide(what, id) 
{
var d = document.getElementById(what+id);
if (d.style.display=='none') 
	{
	d.style.display='block';
	document.cookie = what+"=y";
	}
else
	{
	d.style.display='none';
	document.cookie = what+"=n";
	}
}

function verifrem()
	{
	var mess = document.remarks.message.value;
	
	if (mess == '')
		{
		message='Please write a message and press send.';
		}
	else
		{
		message ='';
		}
	
	if (message=='')
		{
		return true;
		}
	else
		{
		// il y a une erreur dans le remplissage du formulaire, on affiche le message
		alert(message);
		return false;
		}
	}


function verif()
	{
	var Email = document.customer.Email.value;
	var message='';
	
	if (Email!='')
		{
		indexAroba = document.customer.Email.value.indexOf('@');
      	indexPoint = document.customer.Email.value.indexOf('.');
      	if ((indexAroba < 0) || (indexPoint < 0))      
			{
			//dans le cas ou il manque soit le . soit l'@ on modifie la couleur d'arri�re plan du champ mail et d�finissons un message d'alerte
			document.customer.Email.style.backgroundColor = "#F9DA06";
         	message += "Sorry, the email address isn't correct.\n";			
			}
		}
	
	
	if (document.getElementById('newcontactmail'))
	{
	var ContactEmail = document.getElementById('newcontactmail').value;
	var ContactLast = document.getElementById('newcontactlast').value;
	var ContactFirst = document.getElementById('newcontactfirst').value;
	if (ContactEmail!='')
		{
		indexAroba = ContactEmail.indexOf('@');
      	indexPoint = ContactEmail.indexOf('.');
      	if ((indexAroba < 0) || (indexPoint < 0))      
			{
			//dans le cas ou il manque soit le . soit l'@ on modifie la couleur d'arri�re plan du champ mail et d�finissons un message d'alerte
			message += "Sorry, the email address for new contact name isn't correct.\n";			
			}
		if (ContactLast=='')
			message+= "Lastname missing for new contact name.\n";
		if (ContactFirst=='')
			message+= "Firstname missing for new contact name.\n";
		}
	}
	
	if (message=='')
		{
		document.customer.submit();
		}
	else
		{
		// il y a une erreur dans le remplissage du formulaire, on affiche le message
		alert(message);
		}
	}

function verifOptions()
	{
	var pass = document.customer.pass1.value;
	var pass2 = document.customer.pass2.value;
	var message='';
	
	if (pass == pass2)
		{
		message='';
		}
	else
		{
		message += "Sorry, you didn't enter the same password twice.\n";
		document.customer.pass1.style.backgroundColor = "#F9DA06";
		document.customer.pass2.style.backgroundColor = "#F9DA06";
		}
	
	if (pass!='' & pass.length < 6)
		{
			message += "Please use a minimum of 6 characters for your password.\n";
		}
		
	if (message=='')
		{
		document.customer.submit();
		}
	else
		{
		// il y a une erreur dans le remplissage du formulaire, on affiche le message
		alert(message);
		}
	}

var i_f = 0;
function add(zext,sear,page,pricefory,availability,brand,width)
	{
	var ddd = "";
	jQuery.facebox(function($) {
		
		
	/*		
	var cutlengthSample = jQuery("#cutlengthSample").html();
	var widthForTHis = jQuery("#widthForTHis").html();
		widthForTHis = widthForTHis.replace("XXX",width);
	
	var text = "<p><b>"+cutlengthSample+"</b>";
	//text += "<p><? echo translate ('widthForTHis',$lg,$bd); ?><span id='fabwidth' style='font-weight:bold;'>"+width+"</span> cm</p>"; 
	text +="<p>"+widthForTHis+"</p>";
	text += "<form name=\"addfabric\" id='addfabric_form"+i_f+"' action=\"\" method=\"POST\">";
	text += "<input type=hidden name='search' id='order_search' value='"+sear+"'>";
	text +=	"<input type=hidden name='p' id='order_p' value='"+page+"'>";
	text +=	"<input type=hidden name='add' id='order_add' value='"+zext+"'>";
	text +=	"<input type=hidden name='price' id='order_price' value='"+pricefory+"'>";
	text +=	"<input type=hidden name='availability' id='order_availability' value='"+availability+"'>";
	text +=	"<input type=hidden name='brand' id='order_brand' value='"+brand+"'>";
	text +=	"<input type=hidden name='width' id='order_width' value='"+width+"'>";
	text +=	"<table>";
	
	var tr_metric = jQuery("#tr_metric").html();
	var yourReference = jQuery("#yourReference").html();
	var yourClient = jQuery("#yourClient").html();
	var pieceNumber = jQuery("#pieceNumber").html();
	var tr_comments = jQuery("#tr_comments").html();
	var cancel_button = jQuery("#cancel_button").html();
	var order_ajax = jQuery("#order_ajax").html();
	
	text +=	"<tr><td>"+tr_metric;
	text +=	"<td>"+yourReference;
	text +=	"<td>"+yourClient;
	text +=	"<td>"+pieceNumber;
	text +=	"<tr>";
	text +=	"<td><input type='text' name='quantity' id='order_quantity' value='' size='5' id='addcart' tabindex=1 onkeypress='return numbersandmore(event)' >"; 
	text +=	"<td><input type='text' name='legend' id='order_legend' value='' size='10' id='addlegend' tabindex=1>";
	text +=	"<td><input type='text' name='client' id='order_client' value='' size='10' id='addclient' tabindex=1>";
	text +=	"<td><input type='text' name='piece' id='order_piece' value='' size='10' id='addpiece' tabindex=1>";
	text +=	"<tr>";
	text +=	"<td colspan=4>"+tr_comments;
	text +=	"<tr>";
	text +=	"<td colspan=4><input type='text' name='lcomment' id='order_lcomment' value='' size='49' id='addlcomment' tabindex=1>"; 
	text +=	"</table>";
	text +=	"<p>&nbsp;</p><p align=center><a href='javascript:;' id='order_ajax' user='<? echo $user; ?>' lg='<? echo $lg; ?>' class=bouton tabindex=1>"+order_ajax+"</a>";
	text +=	"<a href='javascript:;' onclick='$.facebox.close();' class=bouton tabindex=1>"+cancel_button+"</a></p>";
	text +=	"</form>";
	*/	
	
	//if (d.style.display!='block') {
	//d.style.display='block';
	//	}
	//else {
	//	d.style.display='none';
	//	}
	
	jQuery('#fabwidth').html(width);
	jQuery("#order_add").val(zext);
	jQuery("#order_search").val(sear);
	jQuery("#order_p").val(page);
	jQuery("#order_price").val(pricefory);
	jQuery("#order_availability").val(availability);
	jQuery("#order_brand").val(brand);
	jQuery("#order_width").val(width);
	//document.getElementById('addcart').focus();
	var d = document.getElementById('quantity').innerHTML;
	var dd = d.replace('addfabric_form','addfabric_form'+i_f);
	var ddd = dd.replace('XXXS','<b>'+zext+'</b> ');
	dd = ddd;
	dd = dd.replace('order_ajax','order_ajax'+i_f);
	dd = dd.replace('order_quantity','order_quantity'+i_f);
	dd = dd.replace('order_lcomment','order_lcomment'+i_f);
	dd = dd.replace('order_piece','order_piece'+i_f);
	dd = dd.replace('order_client','order_client'+i_f);
	dd = dd.replace('order_legend','order_legend'+i_f);
	var color = jQuery("#color_"+zext).val();
	//var ddd = dd.replace('#addfabric_form','#addfabric_form'+i_f);
	
	//alert(ddd);
	
	//ddd = ddd.replace("XXX",width);
		jQuery.facebox(dd);
		jQuery('#order_ajax'+i_f).click( function() {
			
			var user = jQuery(this).attr('user');
			var lg = jQuery(this).attr('lg');
			var search = jQuery('#order_search').val();
			var p = jQuery('#order_p').val();
			var add = jQuery('#order_add').val()
			var price = jQuery('#order_price').val();
			var availability = jQuery('#order_availability').val();
			var brand = jQuery('#order_brand').val();
			var width = jQuery('#order_width').val(); 
			var quantity = jQuery('#order_quantity'+i_f).val(); 
			var legend = jQuery('#order_legend'+i_f).val(); 
			var client = jQuery('#order_client'+i_f).val();
			var piece = jQuery('#order_piece'+i_f).val();
			var lcomment = jQuery('#order_lcomment'+i_f).val();
			
			
			
			jQuery.post('/fabricscat/fonctions/ajaxorder.php',{color:color,user:user,lg:lg,search:search,p:p,add:add,price:price,availability:availability,
			brand:brand,width:width,quantity:quantity,legend:legend,client:client,piece:piece,lcomment:lcomment,quantity:quantity},function(data)
			{
				
				
				jQuery('#message_content').html(data);
				if (cart == 1)
				{
					
					//jQuery.facebox('<div align=center>'+data+"<br><br><p>Please wait...</p><p><a href='javascript:;' onclick=\"window.location='/fabricscat/cart.php'\" class=bouton>Close</a></p></div>");
					jQuery.facebox('<div align=center>'+data+"<br><br><p>Please wait...</p></div>");
					jQuery(".close").hide();
					setTimeout('window.location.reload(true);',1000);
				} else {
					jQuery.facebox('<div align=center>'+data+"<br><br><p><a href='javascript:;' onclick='$.facebox.close();' class=bouton>Close</a></p></div>");
				}
				//$('#quantity').hide();
				//jQuery.facebox.close();
			}); 
			/*jQuery.ajax({
		  		type: "POST",
				url: "fonctions/ajaxorder.php",
				data: 'user='++'&lg='++'&search='++'&p='++'&add='++'&price='++'&availability='++'&brand='++'&width='++'&quantity='++'&legend='++'&client='++'&piece='++'&lcomment='+,
				success: function(msg){
					jQuery('#message_content').html(msg);
					jQuery('#message').show();
					//$('#quantity').hide();
					jQuery.facebox.close();
				}
			});
			return false;
			*/
			i_f++;
			return false;
		});
		
	});
}

function PopupImage(img) {

	jQuery.facebox(function($) {
	    //jQuery.get('../fabricscat/help.php',{cat:cat,value:value,lg:lg}, function(data) {
    	    //var dd = data.replace('id=help','id=hh');
    	    jQuery.facebox({image: img})
    	    jQuery("#facebox").click(function()
    	    {
    	    	jQuery.facebox.close();
    	    });
     });

	//turn false;

	//tre="Zoom";
	//open("",'image','width=500,height=426,toolbar=no,scrollbars=no,resizable=no');	
	//document.write("<HTML><HEAD><TITLE>"+titre+"</TITLE></HEAD>");
	//w.document.write("<SCRIPT language=javascript>function checksize()  { if (document.images[0].complete) {  window.resizeTo(document.images[0].width+12,document.images[0].height+30); window.focus();} else { setTimeout('check()',250) } }</"+"SCRIPT>");
	//w.document.write("<BODY onload='checksize()' leftMargin=0 topMargin=0 marginwidth=0 marginheight=0><a href='javascript:window.close();'><IMG src='"+img+"' border=0></a>");
	//w.document.write("");
	//w.document.write("</BODY></HTML>");
	//w.document.close();

}

function AskModif()
	{
	document.customer.mo.value='y';
	}
	
function pdf(id_selection)
	{
	var d = document.getElementById('expdf');
	if (d.style.display!='block') {
		d.style.display='block';
		}
	else {
		d.style.display='none';
		}
	document.exportpdf.id.value=id_selection;
	}

function bunchreport()
	{
	var d = document.getElementById('bunchpdf');
	if (d.style.display!='block') {
		d.style.display='block';
		}
	else {
		d.style.display='none';
		}
	}

function remall(what, lg)
	{
	var message = "Do you really want to remove all ";
		
	if (what=='fabrics' && confirm(message+what))
		document.location.href='?rem=all';
	else if (what=='from your bunch' && confirm(message+what))
		document.location.href='?rembunch=all';
	}
	
function Question(path,message) {
	if (confirm(message))
		document.location.href=path;
}

function verifForm_mail()
	{
	var message='';
	var to_select = document.mail.recipients_id.value;
	if (document.mail.other)
		var to_texte = document.mail.other.value;
	else
		var to_texte='';
	
	if (to_texte=='' && to_select=='')
		message="Please select an email address";
	if (message=='')
		{
		document.mail.submit();
		}
	else
		{
		// il y a une erreur dans le remplissage du formulaire, on affiche le message
		alert(message);
		}
	}






function SubFormTo(page)
	{
		document.formulaire.action = page;
		document.formulaire.submit();
	}



$('.hide_all').click( function() { 
	if ($(this).children('img').attr('src')=='img/vis0.gif')
		var vis = "&vis=1";	
	else
		var vis = "&vis=0"
	
	$.ajax({
  		type: "POST",
		url: "fonctions/hide_element.php",
		data: $(this).attr('href')+vis,
		success: function(msg){
			//alert(msg);
			$('.img_vis').attr("src",msg);
			}
 		});
	return false;
	} );


function removerecipient(id)
	{
	$('#recipient_'+id).hide();
	$('#recipients_id').val($('#recipients_id').val().replace("," + id + ",", ","));
	}


$(document).ready(function(){


$('#nonames_mod').click(function() {
		for (var i=0,a=0;i<$('#max_nonames').val();i++) {
			if ($('.firstname:eq(' + i + ')').val() != '' || $('.name:eq(' + i + ')').val() != '')
				{
				var m = i;
				$.ajax({
			  		type: "POST",
					url: "fonctions/mod_names.php",
					data: 'id='+$('.mod_names_id:eq(' + m + ')').val()+'&firstname='+$('.firstname:eq(' + m + ')').val()+'&name='+$('.name:eq(' + m + ')').val(),
					success: function(msg){
						if (msg == $('.mod_names_id:eq(' + m + ')').val())
							{
							alert($('.firstname:eq(' + m + ')').val() + ' ' + $('.name:eq(' + m + ')').val() + ' saved');
							$('.tr_' + $('.mod_names_id:eq(' + m + ')').val()).hide();
							}
						}
			 		});
				}
			}
		if ($('#max_nonames').val()== '1' && m == '0')
			$('#contacts_without_names').hide();
		return false;
		} );
								 	


$('.recipient').click(function() {
		alert('test');
		} );

selected = new Array();
    // load all selected options in array when the mouse pointer hovers the select box
    $('select').mouseover(function() {
      if (this.multiple == true) {
        for (var i=0,a=0;i<this.options.length;i++) {
          if (this.options[i].selected == true) {
            selected[a] = this.options[i].value;
            a++;
          }
        }
      }
    });
    // safe them when you click the mouse
    $('select').click(function() {
      // make sure it's a multiple select
      if (this.multiple == true && this.value != '') {
        for(var i=0;i<selected.length;i++) {
          for(var a=0;a<this.options.length;a++){
            if (selected[i] == this.options[a].value && this.options[a].selected == true) {
              this.options[a].selected = false;
              selected.splice(i,1);
            } else if (selected[i] == this.options[a].value) {
              this.options[a].selected = true;
            }
          }
        }
      }
    });


	$(".add_favorite").click( function() {
		$('label').removeClass('alert');
		$('label[for=zext_list]').addClass('alert');
		if ($("#zext_list").val() != '')
			$("#zext_list").val($("#zext_list").val() + ", ");
		$("#zext_list").val($("#zext_list").val() + $(this).attr("id"));
		} );


$('#message_hide').click( function() {  
	$('#message').hide();
	return false;
	});


$('.addpdf').click( function() { 
	var m = $(this).attr('id');
	$.ajax({
  		type: "POST",
		url: "fonctions/addpdf.php",
		data: 'id='+$(this).attr('id'),
		success: function(msg){
			if ($('#img_'+m).attr("src")=='img/pictos/pdf_c.gif') {
				$('#img_'+m).parents('tr').css({background: "#DEDEDE" });
				$('#img_'+m).parents('tr').fadeOut('slow');
			} else {
				$('#img_'+m).attr("src",msg);
				$('#pdf_bouton').show();
			}
		}
	});
	return false;
});

$('.remfav').click( function() { 
	var m = $(this).attr('id');
	$.ajax({
  		type: "POST",
		url: "fonctions/remfav.php",
		data: 'id='+$(this).attr('id')+'&user='+$(this).attr('user'),
		success: function(msg){
			if ($('#img_'+m).attr("src")=='img/pictos/del-b.gif')
				{
				$('#img_'+m).parents('tr').css({background: "#DEDEDE" });
				$('#img_'+m).parents('tr').fadeOut('slow');
				//alert(2);
				}
			else
				{
				$('#img_'+m).attr("src",msg);
				//alert(msg);
				var ff = msg.search('_red');
				//alert(ff);
				if (ff > 1)
				{
					$('#img_'+m).attr("title",removefromfavorites);
				} else {
					$('#img_'+m).attr("title",addtofavorites);
				}
				}
			}
 		});
	return false;
	} );

/*
$('#order_ajax').click( function() { 
	$.ajax({
  		type: "POST",
		url: "fonctions/ajaxorder.php",
		data: 'user='+$(this).attr('user')+'&lg='+$(this).attr('lg')+'&search='+$('#order_search').val()+'&p='+$('#order_p').val()+'&add='+$('#order_add').val()+'&price='+$('#order_price').val()+'&availability='+$('#order_availability').val()+'&brand='+$('#order_brand').val()+'&width='+$('#order_width').val()+'&quantity='+$('#order_quantity').val()+'&legend='+$('#order_legend').val()+'&client='+$('#order_client').val()+'&piece='+$('#order_piece').val()+'&lcomment='+$('#order_lcomment').val(),
		success: function(msg){
			$('#message_content').html(msg);
			$('#message').show();
			//$('#quantity').hide();
			jQuery.facebox.close();
		}
	});
	return false;
});
*/

$('.choose_lg').click( function() { 
	$('.mail_message').hide();
	$('#mail_' + $(this).attr('id')).show();
	} );

$('.mail_message').children('blockquote').children('p').children('a').attr('href','#SendPDF');
$('.mail_message').children('blockquote').children('p').children('a').attr('target','');
 });

$(document).ready(function(){ 
						   
	$('.tab').click( function() { 
		$('.tab').removeClass('tabfocus');
		$('.tab').addClass('tabhold');
		$(this).removeClass('tabhold');
		$(this).addClass('tabfocus');
		$('.tabcontent').hide();
		$('#content'+$(this).attr('id')).show();
		return false;
		} );
	
});

function exportallinpdf(search)	{
	//document.exportallinpdf2.search.value = search;
	
	$("#search_pdf").val(search);
	
	var d = document.getElementById('exportallinpdf2');
	
	//$( "#dialog:ui-dialog" ).dialog( "destroy" );
		
	//$( "#exportallinpdf2" ).dialog({
	//	height: 140,
	//	modal: true
	//});
	jQuery.facebox({ div: '#exportallinpdf2' });
	//if (d.style.display!='block') d.style.display='block';
	//else d.style.display='none';
}


