function SubmitCallMe(oid,reason) {

	var oid=oid;
	var reason=reason;
	var firstname=$('firstname').value;
	var surname=$('surname').value;
	var phone=$('phone').value;

	var calltime=document.getElementById('calltime').options[document.getElementById('calltime').selectedIndex].value;
	var title=document.getElementById('title').options[document.getElementById('title').selectedIndex].value;

	if (firstname=="" || surname=="" || phone=="" || calltime=="" || title=="") {
		alert('Please fill all fields in the form!');
		return false;
	}
	else {
		var JSONRequest_up = new Request.JSON({url: '/config/callme_enq.php', 
			onComplete: function(res){ 
				$('main_div').innerHTML="<br/><br /><p align='center'><b>Thank you for your enquiry. <br />We will contact you soon.</b></p>";

		}}).send({
			method: 'get',
			data: 'oid='+oid+'&title='+title+'&firstname='+firstname+'&surname='+surname+'&phone='+phone+'&calltime='+calltime+'&reason='+reason
		});

		


	}
}
function CallMe(oid,reason) {
	var urlink="/callme.php?oid="+oid+"&why="+reason;
	MOOdalBox.open( 
		urlink,
		"",
		"460 350"
	);
}

function showagelists(childformname) {
		var selchildren=document.getElementById(childformname).options[document.getElementById(childformname).selectedIndex].value;

		if (selchildren>0) {
			$('ca_globalholder').reveal();
			for (i=0;i<6;i++) {
				var caelem="ca_holder"+i;
				(i<selchildren) ? $(caelem).reveal() : $(caelem).dissolve();
	}
	}
	else {
			$('ca_globalholder').dissolve();
	}
}

function ShowErrorBox(stay) {
	new Fx.Reveal($('error_box_top')).reveal();
	if (stay==0) var t1=setTimeout("$('error_box_top').nix({duration: 1200},true)",8000);
}

function ShowExtras(obj) {
	if (obj!='') {

		oldobj=$('extras_container').getFirst();
		if (oldobj) $('extras_repository').grab(oldobj);

		if ($('extras_repository').getElementById(obj)) {
			selobj=$('extras_repository').getElementById(obj);
		}
		else {
			selobj=$('extras_repository').getFirst();
		}

			$('extras_container').grab(selobj);
			selobj.fade('hide');
			selobj.fade('in');

		if (obj=='ship_features') {

				var myAccordion2 = new Accordion($('accordion2'), 'h3.toggler2', 'div.element2', {
				opacity: true,
				display:0,
				onActive: function(toggler, element){
					toggler.setStyle('font-weight', 'bold');
				},
				onBackground: function(toggler, element){
					toggler.setStyle('font-weight', 'normal');
				},
				onComplete: function (toggler) {
					$('ship_features').scrollIntoView(true);
				}
				});
		}

		if (obj=="deck_plans") {
				var myAccordion3 = new Accordion($('accordion3'), 'div.toggler3', 'div.element3', {
				opacity: true,
				display:0,
				onActive: function(toggler, element){
					toggler.setStyle('font-weight', 'bold');
				},
				onBackground: function(toggler, element){
					toggler.setStyle('font-weight', 'normal');
				},
				onComplete: function (toggler) {
					$('deck_plans').scrollIntoView(true);
				}
				});
		}

	}
}


function ChangePartySize(selector,amaxc, cmaxc, tmaxc) {
	var adults=$('adultselector').getSelected();
	var children=$('childselector').getSelected();
	if (selector=="adult") {
		var children_max=tmaxc-adults[0].value;
		if (children_max>cmaxc) children_max=cmaxc;
   		$('childselector').empty();
   	 	for (p = 0; p <= children_max; p++) {
			if (p==children[0].value)   new Element('option', {'value': p, 'text':p,'selected' :'selected'}).inject($('childselector'));
          		else new Element('option', {'value': p, 'text':p}).inject($('childselector'));
       	}
	}
	else {
		var adults_max=tmaxc-children[0].value;
		if (adults_max>amaxc) adults_max=amaxc;

   		 $('adultselector').empty();

   	 	for (p = 1; p <= adults_max; p++) {
			if (p==adults[0].value)     	new Element('option', {'value': p, 'text':p,'selected':'selected'}).inject($('adultselector'));
          	       else     	new Element('option', {'value': p, 'text':p}).inject($('adultselector'));
       	}
	}

}

function PartySelectionSubmit(oid, amaxc, cmaxc) {
	if (amaxc>0) var adults=document.getElementById("adultselector").options[document.getElementById("adultselector").options.selectedIndex].value;
	if (cmaxc>0) var children=document.getElementById("childselector").options[document.getElementById("childselector").options.selectedIndex].value;

	if (adults>0) {
		document.getElementById("pt_container").innerHTML='<div style="padding-top:6px;"><span class="extra">Please wait...</span></div>';
		frames.party_container.location.href='/config/xml/OfferDetailsRQ.php?oid='+oid+'&adults=' + adults + '&children='+children;	
   }
}

function ReloadCruiseLinePage() {
	var clselected=document.getElementById("clselector").options[document.getElementById("clselector").options.selectedIndex].value;
	if (clselected) {
		clbits=clselected.split("|");
		cl=clbits[0].replace(" ","-");
		location.href="/cruise-lines/"+cl+"/"+clbits[1]+"/";
	}
}

function ReloadShipPage() {
	var shselected=document.getElementById("shselector").options[document.getElementById("shselector").options.selectedIndex].value;
	if (shselected) {
		shbits=shselected.split("|");
		sh=shbits[0].replace(" ","-");
		location.href="/ships/"+sh+"/"+shbits[1]+"/";
	}
}

function ReloadDestinationPage() {
	var dsselected=document.getElementById("dsselector").options[document.getElementById("dsselector").options.selectedIndex].value;
	if (dsselected) {
		dsbits=dsselected.split("|");
		ds=dsbits[0].replace(" ","-");
		location.href="/destinations/"+ds+"/"+dsbits[1]+"/";
	}
}

function ReloadCabinAvailPage(oid) {
	var daselected=document.getElementById("daselector").options[document.getElementById("daselector").options.selectedIndex].value;
	if (daselected) {
		document.getElementById("da_container").innerHTML='<span class="extra">Please wait...</span>';
		frames.search_container.location.href='/config/xml/OfferDetailsRQ.php?oid='+oid+'&depairport='+daselected;	
   }
}

function getNewXMLHttpRequest() {
  var obj;
    try {
      obj = new ActiveXObject('Microsoft.XMLHTTP');
    }
    catch(e) {
      try {
        obj = new XMLHttpRequest();
      }
      catch (e) {
        obj = false;
      }
    }
    return obj;
}


function CheckCabins (oid,cid) {
	if (cid!=undefined && cid!=null && oid!=undefined && oid!=null) {
		obtn="check_cabins_btn_"+oid+"_"+cid;
		$(obtn).innerHTML='<img src="/images/please_wait_btn.gif" width="179" height="40" border="0" alt="" />';


		var JSONRequest = new Request.JSON({url: '/config/xml/CabinAvailabilityRQ.php', 

		onComplete: function(res){ 
		var urlink="/checkcabins.php?oid="+oid+"&cid="+cid;
			MOOdalBox.open( 
				urlink,
				"",
				"580 600"
			);
		$(obtn).innerHTML='<a href="javascript:CheckCabins(\''+oid+'\',\''+cid+'\');"><img src="/images/check_cabins.gif" width="179" height="40" alt="check cabins" title="check cabins" border="0" onmouseover="this.src=\'/images/check_cabins_.gif\'; return true;" onmouseout="this.src=\'/images/check_cabins.gif\'; return true;" /></a>';
		}}).get({'oid':oid,'cid':cid});


  }
}


function ShowDeckPlan (oid,cid,cabno,deckno) {
	if (cid!=undefined && cid!=null && oid!=undefined && oid!=null && cabno!=undefined && cabno!=null && deckno!=undefined && deckno!=null) {
		vdpbtn="view_deck_plan_btn_"+oid+"_"+cid+"_"+cabno;
		cabitem="ci_"+oid+"_"+cid+"_"+cabno;

		$(vdpbtn).innerHTML='<a href="javascript:HideDeckPlan(\''+oid+'\',\''+cid+'\',\''+cabno+'\',\''+deckno+'\');"><img src="/images/hide_deck_plan.gif" width="179" height="40" border="0" alt="" /></a>';

		dp_holder="dp_holder"+cabno;
		new Fx.Reveal($(dp_holder)).reveal();
  }
}

function HideDeckPlan (oid,cid,cabno,deckno) {
	if (cid!=undefined && cid!=null && oid!=undefined && oid!=null && cabno!=undefined && cabno!=null && deckno!=undefined && deckno!=null) {

		vdpbtn="view_deck_plan_btn_"+oid+"_"+cid+"_"+cabno;
		$(vdpbtn).innerHTML='<a href="javascript:ShowDeckPlan(\''+oid+'\',\''+cid+'\',\''+cabno+'\',\''+deckno+'\');"><img src="/images/view_deck_plan.gif" width="179" height="40" alt="view deck plan" title="view deck plan" border="0" onmouseover="this.src=\'/images/view_deck_plan_.gif\'; return true;" onmouseout="this.src=\'/images/view_deck_plan.gif\'; return true;" /></a></div>';

		dp_holder="dp_holder"+cabno;
		$(dp_holder).dissolve();
	}
}


function AddShortListItems(oid, curr_count) {
	if (oid!='' && oid!='undefined' && oid!=null) {
		var JSONRequest = new Request.JSON({url: '/config/shortlist_item.php', 
		onComplete: function(res){ 
			$('shortlist_counterbox').innerHTML='<b>Loading - please wait...</b>';
			var results=res.results;
			var resno=results.length;
			var resbox = $('shortlist_content');
			var enq_button_holder=$('shortlist_bottom');
			var objnum=$('shortlist_content').getElements('div[class=shortlist_item]');
	if (resno>0) {

		$('shortlist_counterbox').innerHTML='You have <b>'+curr_count+'</b> item(s) on your shortlist.';
		
		results.each (function(result) {

			var el = new Element('div', {'id': 'sl'+result.NormalisedOid,'class': 'shortlist_item'});

			var cl	= new Element('div', { 'class': 'shortlist_close'});
			var close_button = new Element('span', {'html':'<a href="javascript:RemoveFromShortList(\''+result.NormalisedOid+'\');"><img src="/images/shortlist_close.gif" width="15" height="15" alt="remove" title="remove" align="right" border="0" /></a>'}).inject(cl);
			cl.inject(el);

			if (result.Grade!='' && result.Grade!=undefined) {
				var ct = new Element('div',{'class': 'shortlist_title'});
				if (result.IncludesFlights=="true") fl=" (incl. flights)"; else fl=" (cruise only)";
				var cruisetitle = new Element ('span', {'html': '<a href="/availability/'+result.CruiseLineName.replace(/ /g,"-").replace(/&/g,"and")+'/'+result.ShipName.replace(/ /g,"-")+'/'+result.EmbarkDate+'/'+result.oid+'#'+result.Grade+'" class="deal_title">'+result.OfferTitle+''+fl+'</a>'}).inject(ct);
				ct.inject(el);

				var sn = new Element('div',{'class': 'shortlist_undertitle', 'styles': {'margin-bottom':'4px'}});
				new Element ('span',{'html': '<b>'+result.ShipName+'</b> / '+result.CruiseLineName}).inject(sn);
				sn.inject(el);
			}
			else {
				var ct = new Element('div',{'class': 'shortlist_title'});
				if (result.IncludesFlights=="true") fl=" (incl. flights)"; else fl=" (cruise only)";

				var cruisetitle = new Element ('span', {'html': '<a href="/getdetails/'+result.CruiseLineName.replace(/ /g,"-").replace(/&/g,"and")+'/'+result.ShipName.replace(/ /g,"-")+'/'+result.EmbarkDate+'/'+result.oid+'" class="deal_title">'+result.OfferTitle+''+fl+'</a>'}).inject(ct);
				ct.inject(el);

				var sn = new Element('div',{'class': 'shortlist_undertitle', 'styles': {'margin-bottom':'4px'}});
				new Element ('span',{'html': '<b>'+result.ShipName+'</b> / '+result.CruiseLineName}).inject(sn);
				sn.inject(el);
			}
			var dealbox	= new Element('div', {'class': 'shortlist_undertitle'});

			var logobox	= new Element('div', {'class': 'deal_pic', 'styles': {'background-image': 'url('+result.ShipLogo+')', 'background-repeat': 'no-repeat', 'background-position': 'top center'}});

			var cruiselogobox = new Element('div',{'class': 'deal_logo'});
			var cruiselogo = new Element ('span', {'html': '<img src="/pictures/Image/logos/'+result.CruiseLineCode+'.jpg" width="95" height="25" title="'+result.ShipName+' - '+result.CruiseLineName+'" alt="'+result.ShipName+' - '+result.CruiseLineName+'" border="0" class="cruiselogo" />'}).inject(cruiselogobox);
			cruiselogobox.inject(logobox);

			var tb= new Element('div',{'class': 'shortlist_text'});
			if (result.Grade!='' && result.Grade!=undefined) gradeopt='Cabin grade: <b>'+result.Grade+'</b><br />'; else gradeopt='';
			if (result.Cabin!='' && result.Cabin!=undefined) cabinopt='Cabin No.: <b>'+result.Cabin+'</b><br />'; else cabinopt='';
			if (result.DefaultAirportName!='' && result.DefaultAirportName!=undefined) depairport='Dep. airport: <b>'+result.DefaultAirportName+'</b><br />'; else depairport='';

			if (result.Price>0) {
			if (result.ChildPrice>0) var cp='<br />Child from <b>&pound;'+result.ChildPrice; else var cp='';
			var pricetag='Adult from &pound;'+result.Price+cp;
			if (result.Children=="undefined") result.Children=0;
				new Element ('span', {'html': '<b>'+result.DestinationName+'</b><br /><b>'+result.EmbarkDateNormalised+'</b><br />Duration: <b>'+result.SailingDuration+' nights</b><br />Adults: <b>'+result.Adults+'</b><br />Children: <b>'+result.Children+'</b><br />'+gradeopt+''+cabinopt+''+depairport}).inject(tb);
			}
			else {
			var pricetag='<span class="index"><b>'+result.PriceText+'</b></span>';
				new Element ('span', {'html': '<b>'+result.DestinationName+'</b><br /><b>'+result.EmbarkDateNormalised+'</b><br />Duration: <b>'+result.SailingDuration+' nights</b><br />Adults: <b>'+result.Adults+'</b><br />Children: <b>'+result.Children+'</b><br />'+gradeopt+''+cabinopt+''+depairport}).inject(tb);
			}
			tb.inject(dealbox);



			logobox.inject(dealbox);

			dealbox.inject(el);
			
			var pr = new Element('div',{'class': 'shortlist_undertitle2'});
			new Element ('span',{'html': pricetag}).inject(pr);
			pr.inject(el);


			el.inject(resbox);
			new Fx.Reveal($(el)).reveal();
			$(el).tween('background-color', '#cccccc', '#ffffff');

		});
	}
	if (curr_count>0) { 

			$('shortlist_counterbox').innerHTML='You have <b>'+curr_count+'</b> item(s) on your shortlist.';
			if (objnum.length==0)	
				{

					var sleb = new Element('div', {'id': 'shortlist_enquiry_button'});
					var sl_button = new Element('span', {'html':'<a href="/enquire/#enquiry" ><img src="/images/shortlist_button.gif" width="134" height="43" alt="enquire" title="enquire" border="0" onmouseover="this.src=\'/images/shortlist_button_.gif\'; return true;" onmouseout="this.src=\'/images/shortlist_button.gif\'; return true;"/></a>'}).inject(sleb);

				enq_button_holder.innerHTML='';
				sleb.inject(enq_button_holder);
				$(sleb).reveal();
				}
		}

		else	{

			$('shortlist_counterbox').innerHTML='Your shortlist is empty.';
			$('shortlist_enquiry_button').dissolve();
		}
	}}).get({'oid':oid});
   }
	else {
		$('shortlist_counterbox').innerHTML='Your shortlist is empty.';
	}
}


function RemoveFromShortList(oid) {
		var request = getNewXMLHttpRequest();
		geturl='/config/shortlist.php?oid='+oid+'&action=delete';
		request.open('GET', geturl);

		request.onreadystatechange=function() {
		  if (request.readyState==4) {

				var response=request.responseText;
				var params=response.split(":");
				var exists=params[0];		
				var curr_count = params[1];

		var counterbox=$('shortlist_counterbox');
		var enq_button=$('shortlist_enquiry_button');

		if (curr_count>0) {		counterbox.innerHTML='You have <b>'+curr_count+'</b> item(s) on your shortlist.'; }
		else {	
			counterbox.innerHTML='Your shortlist is empty.'; 
			$(enq_button).dissolve();
		}

			var otd='sl'+oid;
			$(otd).tween('background-color', '#ffffff', '#cccccc');
			$(otd).nix({duration: 500},true);
			
		  }
		}
    		request.send(null);	
}

function RemoveFromShortListFinal(oid) {
		var request = getNewXMLHttpRequest();
		geturl='/config/shortlist.php?oid='+oid+'&action=delete';
		request.open('GET', geturl);

		request.onreadystatechange=function() {
		  if (request.readyState==4) {

				var response=request.responseText;
				var params=response.split(":");
				var exists=params[0];		
				var curr_count = params[1];

			var otd='sl'+oid;
			$(otd).tween('background-color', '#ffffff', '#cccccc');
			$(otd).nix({duration: 500},true);

			if (curr_count==0) {
			window.location.href='/enquire/';
		}
	
			
		  }
		}
    		request.send(null);	

}

function change_btn(oid, mode,grade,cabin) {

	var obj='add_to_shortlist_btn_'+oid;
if (grade!=undefined && grade!='') obj+='_'+grade;
if (cabin!=undefined && cabin!='') obj+='_'+cabin;
	switch (mode) {
		case "0": {
			$(obj).innerHTML='<img src="/images/adding_btn.gif" width="179" height="40" alt="" title="" border="0" />';
			break;

		}
		case "1": {
			$(obj).innerHTML='<img src="/images/done_btn.gif" width="179" height="40" alt="" title="" border="0" />';
			break;
		}
		case "2": {
			$(obj).innerHTML='<a href="javascript:AddToShortList(\''+oid+'\',\''+grade+'\',\''+cabin+'\');"><img src="/images/add_to_shortlist.gif" width="179" height="40" alt="add to shortlist" title="add to shortlist" border="0" /></a>';
			break;
		}
	}
}

function AddToShortList(oid,grade,cabin) {
	
var objnum=$('shortlist_content').getElements('div[class=shortlist_item]');
	if (objnum.length<5) {


		var request = getNewXMLHttpRequest();
		geturl='/config/shortlist.php?oid='+oid+'&grade='+grade+'&cabin='+cabin+'&action=add';
		request.open('GET', geturl);
		request.onreadystatechange=function() {

		  if (request.readyState==4) {
				var response=request.responseText;
				var params=response.split(":");
				var curr_count = params[1];
				var exists=params[0];
				if (exists==0) {
		var offid='';
		if (grade!='' && grade!=undefined) offid=oid+'_'+grade; else offid=oid;
		if (cabin!='' && cabin!=undefined) offid=offid+'_'+cabin; 
					change_btn(oid,'0',grade,cabin);
					var t1=setTimeout("change_btn('"+oid+"','1','"+grade+"','"+cabin+"')",500);
					AddShortListItems(offid,curr_count);	
					var t2=setTimeout("change_btn('"+oid+"','2','"+grade+"','"+cabin+"')",2000);
				}
		  }
		}
		
    		request.send(null);	
	}
	else {
		alert('Maximum capacity reached!');	
	}
}

function CheckAvailability(id) {

	frames.search_container.location.href='/config/xml/OfferAvailRQ.php?oid='+id;
}

function ChangePage(page) {
	document.getElementById("pbt_paging_top").innerHTML='<span class="extra">Please wait...</span>';
	document.getElementById("pbt_paging_bottom").innerHTML='<span class="extra">Please wait...</span>';
	frames.search_container.location.href='/config/xml/OfferSearchRQ.php?page='+page;
}

function ChangeResultsOrder(url) {
	document.getElementById("pbt_paging_top").innerHTML='<span class="extra">Please wait...</span>';
	document.getElementById("pbt_paging_bottom").innerHTML='<span class="extra">Please wait...</span>';

	var selord=document.getElementById("sorder").options[document.getElementById("sorder").options.selectedIndex].value;
	selparams=selord.split("|");
	var newurl=url+'/sort='+selparams[0]+'/sortdir='+selparams[1]+'/#search_results';
	location.href=newurl;

}

function ValidateSearchForm() {
	//do some validation here, if required

	// everythings fine, lets build url
			wlh='/results/cruise_type='+document.getElementById("cruise_type").options[document.getElementById("cruise_type").options.selectedIndex].value +
			'/destination='+document.getElementById("destination_id").options[document.getElementById("destination_id").options.selectedIndex].value +
			'/cruise_line='+document.getElementById("cruise_line_id").options[document.getElementById("cruise_line_id").options.selectedIndex].value +
			'/ship='+document.getElementById("ship_id").options[document.getElementById("ship_id").options.selectedIndex].value +
			'/departure_date='+document.getElementById("departure_date").options[document.getElementById("departure_date").options.selectedIndex].value +
			'/duration='+document.getElementById("duration").options[document.getElementById("duration").options.selectedIndex].value +
			'/page=1/#search_results';
			window.location=wlh;
}

function disableIt(obj) { 	obj.disabled = !(obj.disabled); }




function GetShips(targ) {
		var request = getNewXMLHttpRequest();
		var pos=0;
		var cid = document.getElementById("cruise_line_id").options[document.getElementById("cruise_line_id").selectedIndex].value;	
	if (cid!='') {
		document.getElementById("ship_id").options.length = 0;
		document.getElementById("ship_id").options[0] = new Option('Loading...','');
		disableIt(document.getElementById("ship_id"));
		 geturl='/config/getships.php?cid='+cid;
		request.open('GET', geturl);
		request.onreadystatechange=function() {
		  if (request.readyState==4) {
		           var response = request.responseText;
			     var resorts = response.split('|');
				for(i=0;i<resorts.length;i++){
					resort= resorts[i];
					resortbits = resort.split(":");
					if(resortbits[1]!=''){
						if (targ != 'none' && targ==resortbits[1])	{ 
				var pos=document.getElementById("ship_id").options.length;
				document.getElementById("ship_id").options[document.getElementById("ship_id").options.length] = new Option(resortbits[0],resortbits[1], "selected");

				}
						else	document.getElementById("ship_id").options[document.getElementById("ship_id").options.length] = new Option(resortbits[0],resortbits[1]);		
					}
				}
				document.getElementById("ship_id").options[0] = null;
			if (targ!='none' && pos>0) {
				document.getElementById("ship_id").selectFirstOption = false;
				document.getElementById("ship_id").options[pos-1].selected = true;
			}
				disableIt(document.getElementById("ship_id"));
			}
	 }
    		request.send(null);	
}
}



function SubscribeMe() {
	var subemail=$('sub_email').value;
	var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
  	 if(reg.test(subemail) == false) {
	      alert('Invalid Email Address!');
	   }
	else {
	var subrequest = getNewXMLHttpRequest();
	 geturl='/config/subscribe.php?subemail='+subemail;
		subrequest.open('GET', geturl);
		subrequest.onreadystatechange=function() {
		  if (subrequest.readyState==4) {
		           var response = subrequest.responseText;
				if (response=="0") { alert('An error occured. Please check your email address.');}
				else if (response=="1") { alert('Thank you for subscribing to our newsletter.'); $('sub_email').value='';}
				else if (response=="2") { alert(subemail+' already exists in our database!'); $('sub_email').value='';}
		 }
		}
    		subrequest.send(null);	

	}

}


function check_email() {
	emcheck=document.newsletter_form.sub_email.value;
	
	if (!(emcheck.indexOf(".") > 2) || !(emcheck.indexOf("@") > 0)) {
		alert ('Please type proper e-mail address!');
		return false;
	}
	else {
		document.newsletter_form.submit(); 
	}
	
}
function number_format( number, decimals, dec_point, thousands_sep ) {
    var n = number, c = isNaN(decimals = Math.abs(decimals)) ? 2 : decimals;
    var d = dec_point == undefined ? "." : dec_point;
    var t = thousands_sep == undefined ? "," : thousands_sep, s = n < 0 ? "-" : "";
    var i = parseInt(n = Math.abs(+n || 0).toFixed(c)) + "", j = (j = i.length) > 3 ? j % 3 : 0;
    
    return s + (j ? i.substr(0, j) + t : "") + i.substr(j).replace(/(\d{3})(?=\d)/g, "$1" + t) + (c ? d + Math.abs(n - i).toFixed(c).slice(2) : "");
}


 function showpicture(url,width, height)
	{
        LeftPosition=(screen.width)?(screen.width-width)/2:100;
     TopPosition=(screen.height)?(screen.height-height)/2:100;
        var Win = window.open(url,'showpic','width=' + width + ',height=' + height + ',top='+TopPosition+',left='+LeftPosition+',resizable=0,scrollbars=no,menubar=no,toolbar=no,status=no')
	}


 function openpopup(url,width, height,scrollable)
	{
        LeftPosition=(screen.width)?(screen.width-width)/2:100;
     TopPosition=(screen.height)?(screen.height-height)/2:100;
if (scrollable==0 || scrollable=="")
        var Win = window.open(url,'showpic','width=' + width + ',height=' + height + ',top='+TopPosition+',left='+LeftPosition+',resizable=0,scrollbars=no,menubar=no,toolbar=no,status=no')
else 
        var Win = window.open(url,'showpic','width=' + width + ',height=' + height + ',top='+TopPosition+',left='+LeftPosition+',resizable=0,scrollbars=yes,menubar=no,toolbar=no,status=no')

	}

