//BROWSER DETECTION
var ns4 = document.layers;
var ns6 = document.getElementById && !document.all;
var ie4 = document.all;
 
function DetectBrowser(){ //Detectarea browserului folosit
	this.ver=navigator.appVersion
	this.agent=navigator.userAgent
	this.dom=document.getElementById?1:0
	this.opera5=(navigator.userAgent.indexOf("Opera")>-1 && document.getElementById)?1:0
	this.ie5=(this.ver.indexOf("MSIE 5")>-1 && this.dom && !this.opera5)?1:0; 
	this.ie6=(this.ver.indexOf("MSIE 6")>-1 && this.dom && !this.opera5)?1:0;
	this.ie4=(document.all && !this.dom && !this.opera5)?1:0;
	this.ie=this.ie4||this.ie5||this.ie6
	this.mac=this.agent.indexOf("Mac")>-1
	this.ns6=(this.dom && parseInt(this.ver) >= 5) ?1:0; 
	this.ns4=(document.layers && !this.dom)?1:0;
	this.bw=(this.ie6 || this.ie5 || this.ie4 || this.ns4 || this.ns6 || this.opera5)
	return this
}
var bw=new DetectBrowser();

//IMAGES
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_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_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 MM_showHideLayers() {
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v='hide')?'hidden':v; }
    obj.visibility=v; }
}

function MM_reloadPage() {  //reloads the window if resized
  location.reload();
}
//onresize = MM_reloadPage;


function Go(url){
	document.location = url;
}


function popup(adresa, w, h, scr){
var l=(screen.availWidth-w)/2 , t=(screen.availHeight-h)/2;
win=window.open(adresa,"_blank","width="+w+",height="+h+",left="+l+",top="+t+",statusbar=no,toolbar=no,scrollbars="+scr+",navbar=no");
win.focus();
}
 

//FIELDS
function imgField(field, img){
	if(img == "over") {
		border_color 	= "#999999";
		border_style 	= "solid";
		bgcolor 		= "#FFFFFF";
	}else {
		border_color 	= "#999999";
		border_style 	= "solid";
		bgcolor 		= "#F9F9F9";
	}
	//field.style.borderColor 	= border_color;
	field.style.borderStyle 	= border_style;
	field.style.backgroundColor = bgcolor;
}

//BUTS
function imgBut(but, img){
	but.src = img;
}


//Reset Form
function resetForm(formName){
	if(ns6) form = eval("document.getElementById('"+formName+"')");
	else if(ns4) form = eval("document."+formName);
	else form = eval("document.all."+formName);
	form.reset();
}

function check(){

	if($('#startDate1').attr('value') == 'Arrival'){
		alert('Enter your check-in and check-out dates in the search box on the to see the exact room prices for your stay and to be able to sort by price.');
		return false;
	}else
		if($('#startDate1').attr('value') == ''){
			alert('Enter your check-in and check-out dates in the search box on the to see the exact room prices for your stay and to be able to sort by price.');
			return false;
		}else
			 if( $('#endDate1').attr('value') == 'Departure'){	
				alert('Enter your check-in and check-out dates in the search box on the to see the exact room prices for your stay and to be able to sort by price.');
				return false;
			}else
			 if( $('#endDate1').attr('value') == ''){	
				alert('Enter your check-in and check-out dates in the search box on the to see the exact room prices for your stay and to be able to sort by price.');
				return false;
			}			
			else	
				return true;
}

function focus2(field){
	if(field.value == 0) field.value = '';
}	


function blur2(field){
	if(field.value == '') field.value = '0';
}	


function fieldValue(field_name){
	if(ns6) field = eval("document.getElementById('"+field_name+"')");
	else if(ns4) field = eval("document."+field_name);
	else field = eval("document.all."+field_name);
	return field.value;
}

function setFieldValue(field_name, val){
	if(ns6) field = eval("document.getElementById('"+field_name+"')");
	else if(ns4) field = eval("document."+field_name);
	else field = eval("document.all."+field_name);
	return field.value;
	field.value = val;
}

function writeIn(field_name, val){
	if(ns6) field = eval("document.getElementById('"+field_name+"')");
	else if(ns4) field = eval("document."+field_name);
	else field = eval("document.all."+field_name);
	field.innerHTML = val;
}



function formatNR(nr, dec)
{
str = "" + Math.round(eval(nr) * Math.pow(10,dec));
while(str.length < dec)
	str = "0" + str;
decidx = str.length - dec;
tmp = str.substring(0,decidx);
if(tmp == '')
	tmp = '0';
if(dec > 0)
	tmp = tmp + '.' + str.substring(decidx, str.length);
return(tmp);
}



function getkey(e)
{
if (window.event)
   return window.event.keyCode;
else if (e)
   return e.which;
else
   return null;
}


function goodchars(e, goods)
{
var key, keychar;
key = getkey(e);
if (key == null) return true;

// get character
keychar = String.fromCharCode(key);
keychar = keychar.toLowerCase();
goods = goods.toLowerCase();

// check goodkeys
if (goods.indexOf(keychar) != -1)
	return true;

// control keys
if ( key==null || key==0 || key==8 || key==9 || key==13 || key==27 )
   return true;

// else return false
return false;
}



function getSelectedRadio(buttonGroup) {
   // returns the array number of the selected radio button or -1 if no button is selected
   if (buttonGroup[0]) { // if the button group is an array (one button is not an array)
      for (var i=0; i<buttonGroup.length; i++) {
         if (buttonGroup[i].checked) {
            return i
         }
      }
   } else {
      if (buttonGroup.checked) { return 0; } // if the one button is checked, return zero
   }
   // if we get to this point, no radio button is selected
   return -1;
} // Ends the "getSelectedRadio" function

function getSelectedRadioValue(buttonGroup) {
   // returns the value of the selected radio button or "" if no button is selected
   var i = getSelectedRadio(buttonGroup);
   if (i == -1) {
      return "";
   } else {
      if (buttonGroup[i]) { // Make sure the button group is an array (not just one button)
         return buttonGroup[i].value;
      } else { // The button group is just the one button, and it is checked
         return buttonGroup.value;
      }
   }
} // Ends the "getSelectedRadioValue" function

function getSelectedCheckbox(buttonGroup) {
   // Go through all the check boxes. return an array of all the ones
   // that are selected (their position numbers). if no boxes were checked,
   // returned array will be empty (length will be zero)
   var retArr = new Array();
   var lastElement = 0;
   if (buttonGroup[0]) { // if the button group is an array (one check box is not an array)
      for (var i=0; i<buttonGroup.length; i++) {
         if (buttonGroup[i].checked) {
            retArr.length = lastElement;
            retArr[lastElement] = i;
            lastElement++;
         }
      }
   } else { // There is only one check box (it's not an array)
      if (buttonGroup.checked) { // if the one check box is checked
         retArr.length = lastElement;
         retArr[lastElement] = 0; // return zero as the only array value
      }
   }
   return retArr;
} // Ends the "getSelectedCheckbox" function

function getSelectedCheckboxValue(buttonGroup) {
   // return an array of values selected in the check box group. if no boxes
   // were checked, returned array will be empty (length will be zero)
   var retArr = new Array(); // set up empty array for the return values
   var selectedItems = getSelectedCheckbox(buttonGroup);
   if (selectedItems.length != 0) { // if there was something selected
      retArr.length = selectedItems.length;
      for (var i=0; i<selectedItems.length; i++) {
         if (buttonGroup[selectedItems[i]]) { // Make sure it's an array
            retArr[i] = buttonGroup[selectedItems[i]].value;
         } else { // It's not an array (there's just one check box and it's selected)
            retArr[i] = buttonGroup.value;// return that value
         }
      }
   }
   return retArr;
} // Ends the "getSelectedCheckBoxValue" function
  

//Email Validation
function emailValid(email)
{
  var result = false
  var theStr = new String(email)
  var index = theStr.indexOf("@");
  if (index > 0)
  {
    var pindex = theStr.indexOf(".",index);
    if ((pindex > index+1) && (theStr.length > pindex+1))
	result = true;
  }
  return result;
}

function formSubmit(form, act){
	document.forms[form].action = act;
	document.forms[form].submit();
}

function fieldOb(field_name){
	if(ns6) field = eval("document.getElementById('"+field_name+"')");
	else if(ns4) field = eval("document."+field_name);
	else field = eval("document.all."+field_name);
	return field;
}

function changeRowColor(row, color){
	rOb = fieldOb(row);
	rOb.bgColor = color;  
}


/**
 * Forms Validation
 */
var incomplete_fields = '';

//Validates a field
function ValidateField(elem, name){
	if((elem.value == '')||(elem.value == 0))	{
    		alert('INCOMPLETE!\n\nThe following fields have not bee filled: \n'+incomplete_fields);
    		elem.focus();
   	 		return(false);
   	}
	else if(name.indexOf('email') != -1){
			 	if(!emailValid(elem.value)){
					alert('Invalid E-mail address !');
					elem.focus();
   	 				return(false);
				}
	}
	return(true);
}

//Just Validates a field without (alert & focus)
function JustValidateField(elem){
	if((elem.value == '')||(elem.value == 0))	return(false);
	else if(name.indexOf('email') != -1){
			 	if(!emailValid(elem.value)){
   	 				return(false);
				}
	}
	return(true);
}


function BuildIncompleteFields(form, fields){
	incomplete_fields = '';

	mandatory_fields = fields.split(',');
	for(i=0; i<mandatory_fields.length; i++){
		//single field
		elem = eval('form.' + mandatory_fields[i]);
		if(!JustValidateField(elem, mandatory_fields[i])) incomplete_fields += ', ' + mandatory_fields[i];
	}//for

	incomplete_fields = incomplete_fields.substr(2, incomplete_fields.length-2);
}

//Validate form for Mandatory fields to be filled properly
function Validate(form, fields){
   	BuildIncompleteFields(form, fields);

	mandatory_fields = fields.split(',');
	for(i=0; i<mandatory_fields.length; i++){
		
		if(mandatory_fields[i].indexOf('|')){
			//groupped fields (at least one of them must be filled/selected)
			mandatory_group_fields = mandatory_fields[i].split('|');
			valid = 0;
			for(j=0; j<mandatory_group_fields.length; j++){
				elem = eval('form.' + mandatory_group_fields[j]);
				if(ValidateField(elem, mandatory_group_fields[j]) ) valid = 1;
				else return(false);
			}
			if(!valid){
				//no fields filled
				elem = eval('form.' + mandatory_group_fields[0]);
				if(!ValidateField(elem, mandatory_group_fields[0])) return(false);
			}
			
		}else{
			//single field
			elem = eval('form.' + mandatory_fields[i]);
			if(!ValidateField(elem, mandatory_fields[i])) return(false);
		}
		
	}//for
	
	return(true);
}
/*
 * End of Forms Validation ^^^^
 **/

function ValidateLogin(form){
   	if(form.login_user.value == '')	{
    		alert('Please insert username.');
    		form.login_user.focus();
   	 	return(false);
   	}
   	if(form.login_pass.value == '')	{
    		alert('Please insert password.');
    		form.login_pass.focus();
   	 	return(false);
   	}
	return(true);
}

function AddId(id){
	ids = fieldOb('ids');
	if(ids.value == '') ids.value = id;
	else ids.value = ids.value + ',' + id;
}

function SelectBoxes(type, ids){
	arr_ids = ids.split(',');
	for(i = 0; i < arr_ids.length; i++){
		x = MM_findObj('select_' + arr_ids[i]);
		if (x) if (type=='all') x.checked = true; else x.checked = false;
	}
}

function SelectBoxesWithName(type, name, ids){
	arr_ids = ids.split(',');
	for(i = 0; i < arr_ids.length; i++){
		x = MM_findObj(name + arr_ids[i]);
		if (x) if (type=='all') x.checked = true; else x.checked = false;
	}
}

function DeleteMultiple(what) {
	document.forms['frm'].action = what; 
	document.forms['frm'].submit();	
}

function OpenTable(name){
	tabel = fieldOb(name+'_table');
	imagine = fieldOb(name+'_img');
	if(tabel.className == 'hidden'){
		tabel.className = '';
		imagine.src = '_layouts/images/icon_minus.jpg';
	}
	else{
		tabel.className = 'hidden';
		imagine.src = '_layouts/images/icon_plus.jpg';
	}
}

function AjaxTransaction(action, dest_container){
	//alert(action + ' ' +dest_container);
	var xmlHttp;
	try{// Firefox, Opera 8.0+, Safari
		xmlHttp=new XMLHttpRequest();
	}
  	catch (e){// Internet Explorer
		try{
			xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
		}
    	catch (e){
			try{
				xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch (e){
				alert("Your browser does not support AJAX!");
				return false;
			}
		}
	}
    xmlHttp.onreadystatechange=function(){
		div = fieldOb(dest_container);
		if(xmlHttp.readyState==4){
			div.innerHTML=xmlHttp.responseText;
		}else{
			div.innerHTML='Loading...';
		}
	}
    xmlHttp.open("GET",action,true);
    xmlHttp.send(null);
}

function LoadTemplate(quote_id){
	template = fieldOb('template');
	template = template.value;
	selected_template = fieldOb('selected_template');
	selected_template.value = template;
	
	action = '?qms&load_template=' + template + '&quote=' + quote_id;
	dest_container = 'message';
	AjaxTransaction(action, dest_container);
}

function cu(){
	alert('Please log in or register to access all available rates!');
}

function cc(){
	alert('Your message has been sent successfully and we will endeavour to respond to your mail within 2 hours!');
}


function PhotoClick(photo, width){

	$('#main_photo img').attr('src', '_upload/hotels_img/' + photo);

	$('#main_photo img').attr('width', width);

}
function EditImage(id){	
	div = fieldOb('img'+id);		
	if(div.className == 'ascuns') div.className = '';		
	else	div.className = 'ascuns';		
	
}

    function trim(str, chars) {
	return ltrim(rtrim(str, chars), chars);
}
 
function ltrim(str, chars) {
	chars = chars || "\\s";
	return str.replace(new RegExp("^[" + chars + "]+", "g"), "");
}
 
function rtrim(str, chars) {
	chars = chars || "\\s";
	return str.replace(new RegExp("[" + chars + "]+$", "g"), "");
}
    function validateFun() {
	
	    if(trim(document.getElementById('stock_symbol').value) == "") {
		     alert('Enter the Stock Symbol');
			 return false;
		}  else if(trim(document.getElementById('stock_percentage').value) == "") {
		     alert('Enter the percentage');
			 return false;
		} else {
		     return true;
		}
		
	}
	

showMoreUp = function () { 
	var fileCount = parseInt(document.getElementById('upcount').value);
	var divElement = '';
	var fileElement = '';
	var space = document.createTextNode('\u00A0\u00A0');
	fileElement = document.createElement('input');
	fileElement.type = 'text';
	fileElement.size = '20';
	fileElement.name = 'up_text[]';
	fileElement.className = 'field2';

	divElement = document.createElement('div');
	divElement.id = 'multipleUpVal'+(fileCount+1);

	if (document.getElementById('multipleUpVal'+fileCount)) {
		element = document.getElementById('multipleUpVal'+fileCount)
	}
	else element = document.getElementById('multipleUpVal');

	if (fileCount < 5) { 
		element.appendChild(space);
		element.appendChild(fileElement);
		element.appendChild(divElement);
		document.getElementById('upcount').value = fileCount + 1; 
	}
}

showMoreWhy = function () { 
	var fileCount = parseInt(document.getElementById('count').value);
	var divElement = '';
	var fileElement = '';
	var space = document.createTextNode('\u00A0\u00A0');
	fileElement = document.createElement('input');
	fileElement.type = 'text';
	fileElement.size = '20';
	fileElement.name = 'why_text[]';
	fileElement.className = 'field2';

	divElement = document.createElement('div');
	divElement.id = 'multipleVal'+(fileCount+1);

	if (document.getElementById('multipleVal'+fileCount)) {
		element = document.getElementById('multipleVal'+fileCount)
	}
	else element = document.getElementById('multipleVal');

	if (fileCount < 5) { 
		element.appendChild(space);
		element.appendChild(fileElement);
		element.appendChild(divElement);
		document.getElementById('count').value = fileCount + 1; 
	}
}

function validatePhoneNumber(elementValue){
	var phoneNumberPattern = /^\(?(\d{3})\)?[-]?(\d{3})[-]?(\d{4})$/;
	return phoneNumberPattern.test(elementValue);
}
function IsAlpha(sText, Label)
{
   var ValidChars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
   var IsAlpha=true;
   var Char;
   if(sText=="") {alert(Label+ " Should not be Alphabet");return false}
   for (i = 0; i < sText.length && IsAlpha == true; i++) 
   { 
      Char = sText.charAt(i); 
      if(ValidChars.indexOf(Char) == -1) 
      {
         IsAlpha = false;
      }
   }
   if(!IsAlpha)
	   	alert(Label+ " Must Be Alphabet")
   return IsAlpha;
}

function valtrim(Val)
{
	while(''+Val.charAt(0)==' ')
	Val=Val.substring(1,Val.length);
	return Val
}

function IsValueEmpty(Val,Label)
{
	if(valtrim(Val)=="")
	{
		alert(Label+" Should Not be Empty")
		return false
	}
	return true
}


/*
 * Validation in Partner Add section
*/
function validatePartnerAdd(frm)
{
	if( !IsValueEmpty( frm.stock_symbol.value, "Stock Symbol" ) )	{
		frm.stock_symbol.focus();
		return false;
	}

	if(!IsAlpha(frm.stock_symbol.value, "Stock Symbol"))	{
		frm.stock_symbol.focus();
		return false;
	}

	if( !IsValueEmpty( frm.name.value, "Partner Name" ) )	{
		frm.name.focus();
		return false;
	}

	if(!IsAlpha(frm.name.value, "Partner Name"))	{
		frm.name.focus();
		return false;
	}

	if( !IsValueEmpty( frm.a1.value, "Description" ) )	{
		frm.a1.focus();
		return false;
	}

	if(document.getElementById('up_textField').value == '')
	{
		alert("'Upcoming' first field is empty");
		document.getElementById('up_textField').focus();
		return false;
	}

	if(document.getElementById('why_textField').value == '')
	{
		alert("'Why' first field is empty");
		document.getElementById('why_textField').focus();
		return false;
	}

	var urlreg = /(http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?/;
	if( !IsValueEmpty( frm.c_web.value, "Contact Website" ) )	{
		frm.c_web.focus();
		return false;
	}
	if(!frm.c_web.value.match(urlreg))
	{
		alert("Enter Valid URL");
		frm.c_web.focus();
		return false;
	}

	var emailRegex = /^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/;
	if( !IsValueEmpty( frm.c_mail.value, "Contact E-Mail" ) )	{
		frm.c_mail.focus();
		return false;
	}
	if(!frm.c_mail.value.match(emailRegex))
	{
		alert("Enter Valid E-Mail");
		frm.c_mail.focus();
		return false;
	}

	if( !IsValueEmpty( frm.c_ph.value, "Contact Phone" ) )	{
		frm.c_ph.focus();
		return false;
	}
	if(!validatePhoneNumber(frm.c_ph.value))
	{
		alert("Enter Valid US Phone number");
		frm.c_ph.focus();
		return false;
	}

	return true;
}

/*
 * Validation in Partner Edit section
*/
function validatePartnerEdit(frm)
{
	if( !IsValueEmpty( frm.stock_symbol.value, "Stock Symbol" ) )	{
		frm.stock_symbol.focus();
		return false;
	}

	if(!IsAlpha(frm.stock_symbol.value, "Stock Symbol"))	{
		frm.stock_symbol.focus();
		return false;
	}

	if( !IsValueEmpty( frm.name.value, "Partner Name" ) )	{
		frm.name.focus();
		return false;
	}

	if(!IsAlpha(frm.name.value, "Partner Name"))	{
		frm.name.focus();
		return false;
	}

	if( !IsValueEmpty( frm.a1.value, "Description" ) )	{
		frm.a1.focus();
		return false;
	}

	var urlreg = /(http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?/;
	if( !IsValueEmpty( frm.c_web.value, "Contact Website" ) )	{
		frm.c_web.focus();
		return false;
	}
	if(!frm.c_web.value.match(urlreg))
	{
		alert("Enter Valid URL");
		frm.c_web.focus();
		return false;
	}

	var emailRegex = /^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/;
	if( !IsValueEmpty( frm.c_mail.value, "Contact E-Mail" ) )	{
		frm.c_mail.focus();
		return false;
	}
	if(!frm.c_mail.value.match(emailRegex))
	{
		alert("Enter Valid E-Mail");
		frm.c_mail.focus();
		return false;
	}

	if( !IsValueEmpty( frm.c_ph.value, "Contact Phone" ) )	{
		frm.c_ph.focus();
		return false;
	}
	if(!validatePhoneNumber(frm.c_ph.value))
	{
		alert("Enter Valid US Phone number");
		frm.c_ph.focus();
		return false;
	}

	return true;
}

function IsNumeric(sText,Label)
{

   var ValidChars = "0123456789%+-.";
   var IsNumeric=true;
   var Char;
   if(sText=="") {alert(Label+ " Should not be Empty");return false}
   for (i = 0; i < sText.length && IsNumeric == true; i++) 
   { 
      Char = sText.charAt(i); 
      if(ValidChars.indexOf(Char) == -1) 
      {
         IsNumeric = false;
      }
   }
   if(!IsNumeric)
	   	alert(Label+ " Must Be Numeric")
   return IsNumeric;
}

/*
 * Validation in Top Mining section
*/
function validateMining(frm)
{
	if( !IsValueEmpty( document.getElementById('stock_symbol').value, "Stock Symbol" ) )	{
		document.getElementById('stock_symbol').focus();
		return false;
	}

	var urlreg = /(http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?/;
	if( !IsValueEmpty( document.getElementById('stock_url').value, "Stock URL" ) )	{
		document.getElementById('stock_url').focus();
		return false;
	}
	if(!document.getElementById('stock_url').value.match(urlreg))
	{
		alert("Enter Valid URL");
		document.getElementById('stock_url').focus();
		return false;
	}

	if( !IsValueEmpty( document.getElementById('stock_desc').value, "Stock Description" ) )	{
		document.getElementById('stock_desc').focus();
		return false;
	}

	return true;
}
function changeCurrency(value)
{
	flashMovie = document.getElementById("gold_chart");
	var str= "<settings><header><enabled>true</enabled><text>" +value+" History</text></header></settings>";
	var str2="<settings><data_sets><data_set did='0'><file_name>"+value+".csv.php</file_name></data_set></data_sets></settings>";
	flashMovie.setSettings(str,false);
	flashMovie.setSettings(str2,true);

}