// JavaScript Document

// ******************************************************************
// Begin expand/collapse buttons
//
imgout=new Image(9,9);
imgin=new Image(9,9);
//imgout.src="/images/buttons/btn_expand.gif";
//imgin.src="/images/buttons/btn_collapse.gif";
imgout.src="/images/plus8.png";
imgin.src="/images/minus8.png";
 
// this switches expand collapse icons
// The collapse button names should be set to "img<DIVNAME>"
// 
function filter(imagename,objectsrc){
 if (document.images){
  document.images[imagename].src=eval(objectsrc+".src");
 }
}
 
//show OR hide funtion depends on if element is shown or hidden
// The div style.display must start with 'none' or 'inline'
//
function shoh(id,force) { 
 
   // DOM3 = IE5, NS6 
 // Most common
 //
 if (document.getElementById) { 
  if ((document.getElementById(id).style.display == 'none') || (force=='inline')){
   document.getElementById(id).style.display = 'inline';
   filter(("img"+id),'imgin');   
  } else {
   filter(("img"+id),'imgout');
   document.getElementById(id).style.display = 'none';   
  } 
 
   // Old Netscape, etc.
 //
 } else { 
  if (document.layers) { 
   if ((document.id.display == "none") || (force=='inline')){
    document.id.display = 'inline';
    filter(("img"+id),'imgin');
   } else {
    filter(("img"+id),'imgout'); 
    document.id.display = 'none';
   }
  } else {
   if ((document.all.id.style.display == "none") || (force=='inline')){
    document.all.id.style.display = 'inline';
   } else {
    filter(("img"+id),'imgout');
    document.all.id.style.display = 'none';
   }
  }
 }
}
 // END expand/collapse buttons
// ******************************************************************


// ******************************************************************
// START Calculate age
function CalcAge(dob)
{
var dobyear  = dob.substring(0, 4);
var dobmonth = dob.substring(5, 7);
var dobday   = dob.substring(8, 10);

var yr;
Today = new Date();
yr = Today.getFullYear();

var mnth;
mnth = Today.getMonth() + 1; //Month is 0-11 in JavaScript

var dy;
dy = Today.getDate();

var beforebd;
beforedb = 0
if (mnth == dobmonth && dy < dobday) { 
	beforedb = 1;
}

if (mnth < dobmonth) { 
	beforedb = 1;
}

age = ((yr-dobyear)-beforedb);

if ((age > 99) || (age < 1)) {age = 'N/A'};

return age;
}

 // END Calculate age
// ******************************************************************


// ******************************************************************
// START Show Professional Status
function ShowProStat(status_long)
{
	var status_short = "*";
if (status_long == 'PRO') { status_short = "<a href='javascript:popup(&quot;help2&quot;,&quot;/siteinfo/zencoded/noin/pop_ftpro.htm&quot;,&quot;300&quot;,&quot;200&quot;)'>Full-time Pro</a>"; }
if (status_long == 'PTPRO') { status_short = "<a href='javascript:popup(&quot;help2&quot;,&quot;/siteinfo/zencoded/noin/pop_ptpro.htm&quot;,&quot;300&quot;,&quot;200&quot;)'>Part-time Pro</a>"; }
if (status_long == 'AMAT') { status_short = "<a href='javascript:popup(&quot;help2&quot;,&quot;/siteinfo/zencoded/noin/pop_amat.htm&quot;,&quot;300&quot;,&quot;200&quot;)'>Amateur</a>"; }
return status_short;
}
// END Show Professional Status
// ******************************************************************

// ******************************************************************
// START Large Member Icon Code
function LargeMemCon(cont_type)
{
	var MemCon = "*";
if (cont_type == 'basic') { MemCon = '<img src="/images/icons/basimember.gif" width="132" height="28" alt="Basic (free) membership">'; }
if (cont_type == 'gold') { MemCon = '<img src="/images/icons/goldmember.gif" width="132" height="28" alt="Gold membership">'; }
if (cont_type == 'platinum') { MemCon = '<img src="/images/icons/platmember.gif" width="132" height="28" alt="Platinum membership">'; }
if (cont_type == 'PRIMARY')  { MemCon = '<a href="/zencoded/contactus.htm"><img src="/images/icons/stafmember.gif" width="132" height="28" border="0" alt="Click to Contact"></a>'; }
return MemCon;
}
// END Large Member Icon Code
// ******************************************************************


// ******************************************************************
// START Small Member Icon Code
function SmallMemCon(cont_type)
{
var MemCon = "*";
if (cont_type == 'basic') { MemCon = '<img src="/images/icons/basimember_small.gif" width="75" height="16">'; }
if (cont_type == 'gold') { MemCon = '<img src="/images/icons/goldmember_small.gif" width="75" height="16">'; }
if (cont_type == 'platinum') { MemCon = '<img src="/images/icons/platmember_small.gif" width="75" height="16">'; }
if (cont_type == 'PRIMARY')  { MemCon = '<a href="/zencoded/contactus.htm"><img src="/images/icons/stafmember_small.gif" width="75" height="16" border="0"  alt="Click to Contact"></a>'; }
return MemCon;
}
// END Small Member Icon Code
// ******************************************************************



// ******************************************************************
// START CheckLink
function CheckLink(memlink, id)
{
	if (memlink == id) {
		alert('You cannot link to yourself. '+linkmsg);
		document.newsADD.photo_rel_contid.value = "";
		document.newsADD.photo_rel_contid.focus();
		return false
	}
	else
	{
	return true;
	}
}

// END
// ******************************************************************

// Calculate Photo Age

function PhotoDate(pdate)
{
	var lastupyear  = pdate.substring(0, 4);
	var lastupmonth = pdate.substring(5, 7)-1;
	var lastupday   = pdate.substring(8, 10);
	
	Today = new Date();
	var yr =   Today.getFullYear();
	var mnth = Today.getMonth(); //Month is 0-11 in JavaScript
	var dy =   Today.getDate();
	
	var one_day=1000*60*60*24
	var one_minute=1000*60
	
	var lastupfull =new Date(lastupyear, lastupmonth, lastupday); // This is the day of the update at midnight
	var tdayfull   =new Date(yr, mnth, dy); // This is today at midnight
	
	var days = Math.round((tdayfull.getTime()-lastupfull.getTime())/(one_day));
	
	//var colorvalue = days * 5;
	
	//if (colorvalue > 220) {colorvalue = 220;}
	//var colorstring = '<span style="color:rgb('+colorvalue+','+colorvalue+','+colorvalue+');">';
	
	var timetext = days + " days ago.";
	
	if (days == 0) {timetext = ' today.';}
	if (days > 45) {timetext = Math.round(days/30) +' months ago.';}
	if (days > 370) {timetext = Math.round(days/365) +' year ago.';}
	
	var pdatet = '<span class="port_smalltextLighter">Uploaded '+ timetext+ '</span>';
//	var pdatet = '<span class="port_smalltext">'+colorstring+'Uploaded '+ timetext+ '</span></span>';
	
	if (days < 6) {pdatet = '<img src="/images/icons/new_sun3.gif" width="15" height="15" hspace="4" border="0" alt="New Photo" align="Texttop"><span class="port_smalltextnew">New Photo!</span>';}
	
	if (days > 10000) {pdatet = '';}
	
return pdatet;
}
// ******************************************************************

// Calculate Last Update String

function ClacLastUp2(lastup, joindate)
{
	var lastupyear  = lastup.substring(0, 4);
	var lastupmonth = lastup.substring(5, 7)-1;
	var lastupday   = lastup.substring(8, 10);
	
	var lastuptest = lastupyear+'-';
	if (lastupmonth < 10) {lastuptest = lastuptest + '0';}
	lastuptest = lastuptest + (lastupmonth+1)+'-';
	if (lastupday < 10) {lastupfull = lastuptest + '0';}
	lastuptest = lastuptest + lastupday;
	
	Today = new Date();
	var yr =   Today.getFullYear();
	var mnth = Today.getMonth(); //Month is 0-11 in JavaScript
	var dy =   Today.getDate();
	
	var one_day=1000*60*60*24
	var one_minute=1000*60
	
	var lastupfull =new Date(lastupyear, lastupmonth, lastupday); // This is the day of the update at midnight
	var tdayfull   =new Date(yr, mnth, dy); // This is today at midnight
	
	var lastupdatedays = Math.round((tdayfull.getTime()-lastupfull.getTime())/(one_day));
	var colorval = Math.min(lastupdatedays, 110);
	var colorval2 = Math.min(lastupdatedays, 150);
	
	var colorstring = '<span style="color:rgb('+colorval2+','+colorval2+','+colorval+');">';
	
	var lastupstring = colorstring+'Updated ';
	
	if (lastupdatedays <= 0 ){lastupstring = '<img src="/images/icons/new_sun3.gif" width="15" height="15" hspace="4" border="0" align="Texttop">'+lastupstring + 'today</span>';}
	else {
		if (lastupdatedays == 1 ){lastupstring = lastupstring + 'yesterday</span>';}
		else {
	lastupstring = lastupstring + lastupdatedays +' days ago</span>';
	}
	}
	
	if (lastupdatedays > 45) {
		lastupstring = colorstring+'Updated ' + Math.round(lastupdatedays/30) +' <i>months</i> ago</span>';
		if (lastuptest == joindate) {lastupstring='<img src="/images/icons/frown.gif" width="15" height="15" border="0" align="Texttop">'+'&nbsp;'+colorstring+'Never updated</span>';}
	}
	
	if (lastupdatedays > 300 ){
		lastupstring = colorstring+'Hasn&#39;t updated in ages</span>';
	}
	
return lastupstring;
}
// *******************************************************************
// Calculate Last Update in Days

function ClacLastUpDays(lastup)
{
	var lastupyear  = lastup.substring(0, 4);
	var lastupmonth = lastup.substring(5, 7)-1;
	var lastupday   = lastup.substring(8, 10);
	
	Today = new Date();
	var yr =   Today.getFullYear();
	var mnth = Today.getMonth(); //Month is 0-11 in JavaScript
	var dy =   Today.getDate();
	
	var one_day=1000*60*60*24
	var one_minute=1000*60
	
	var lastupfull =new Date(lastupyear, lastupmonth, lastupday); // This is the day of the update at midnight
	var tdayfull   =new Date(yr, mnth, dy); // This is today at midnight
	
	var lastupdatedays = Math.round((tdayfull.getTime()-lastupfull.getTime())/(one_day));
	
return lastupdatedays;
}
// *******************************************************************

function LinkText(webaddr, webname)
{
	webaddr = webaddr.toLowerCase();

  	var firstpos = webaddr.lastIndexOf('http://');
	var lastpos  = webaddr.length;
	if (firstpos == 0) {webaddr = webaddr.substring(7,lastpos);}

	if (webname == '') {webname = webaddr;} 
	var	webstring = '<a href="http://'+webaddr+'" target="_blank" class="port_nav">'+webname+'</a>'
	if (lastpos < 6) {webstring = '<span class="navLink_disabled">No Web Site</span>';}
	
	//check for banned sites
	if (webaddr.lastIndexOf('barsmart.com')>0)  {webstring = '<span class="navLink_disabled">Invalid web link</span>';}
	if (webaddr.lastIndexOf('modellocate.com/model/')>0) {webstring = '<span class="navLink_disabled">This is my web site</span>';}
	if (webaddr.lastIndexOf('modellocate.com/photographer/')>0) {webstring = '<span class="navLink_disabled">This is my web site</span>';}
	if (webaddr.lastIndexOf('giagirl.com')>0)   {webstring = '<span class="navLink_disabled">Invalid web link</span>';}
	if (webaddr.lastIndexOf('modelsrus.com')>0) {webstring = '<span class="navLink_disabled">Invalid web link</span>';}
	if (webaddr.lastIndexOf('maimodel.com')>0) {webstring = '<span class="navLink_disabled">Invalid web link</span>';}
	if (webaddr.lastIndexOf('jesswakefield.com')>0) {webstring = '<span class="navLink_disabled">Invalid web link</span>';}	
	if (webaddr.lastIndexOf('erikamodeling.com')>0) {webstring = '<span class="navLink_disabled">Invalid web link</span>';}	
	if (webaddr.lastIndexOf('nextdoor-kristin.com')>0) {webstring = '<span class="navLink_disabled">Invalid web link</span>';}	
	if (webaddr.lastIndexOf('milkhandbags.com')>0) {webstring = '<span class="navLink_disabled">Invalid web link</span>';}	
	if (webaddr.lastIndexOf('amytaylor.net')>0) {webstring = '<span class="navLink_disabled">Invalid web link</span>';}	
	if (webaddr.lastIndexOf('kristin-jackson.com')>0) {webstring = '<span class="navLink_disabled">Invalid web link</span>';}
	if (webaddr.lastIndexOf('karencogz.com')>0) {webstring = '<span class="navLink_disabled">Invalid web link</span>';}	
	if (webaddr.lastIndexOf('melaniehotlips.com')>0) {webstring = '<span class="navLink_disabled">Invalid web link</span>';}	
	if (webaddr.lastIndexOf('sobegirls.com')>0) {webstring = '<span class="navLink_disabled">Invalid web link</span>';}	
	if (webaddr.lastIndexOf('janeburgess.com')>0) {webstring = '<span class="navLink_disabled">Invalid web link</span>';}	
	if (webaddr.lastIndexOf('misty-dawn.com')>0) {webstring = '<span class="navLink_disabled">Invalid web link</span>';}	
	if (webaddr.lastIndexOf('cristalmatthews.com')>0) {webstring = '<span class="navLink_disabled">Invalid web link</span>';}			
	if (webaddr.lastIndexOf('modelteenz.com')>0) {webstring = '<span class="navLink_disabled">Invalid web link</span>';}			
	if (webaddr.lastIndexOf('wetltd.com')>0) {webstring = '<span class="navLink_disabled">Invalid web link</span>';}			
	if (webaddr.lastIndexOf('angelfire.com/planet/southernstars')>0) {webstring = '<span class="navLink_disabled">Invalid web link</span>';}			
	if (webaddr.lastIndexOf('childsupermodels.com')>0) {webstring = '<span class="navLink_disabled">Invalid web link</span>';}		
	if (webaddr.lastIndexOf('whipsandice.com')>0) {webstring = '<span class="navLink_disabled">Invalid web link</span>';}		
	if (webaddr.lastIndexOf('alexsplayground.com')>0) {webstring = '<span class="navLink_disabled">Invalid: pay site</span>';}
	if (webaddr.lastIndexOf('jjmonet.com')>0) {webstring = '<span class="navLink_disabled">Invalid: porn links</span>';}
	if (webaddr.lastIndexOf('ricochetswimwear.com')>0) {webstring = '<span class="navLink_disabled">Invalid web link</span>';}	
	if (webaddr.lastIndexOf('fashion4legs.com')>0) {webstring = '<span class="navLink_disabled">Invalid web link</span>';}		
	if (webaddr.lastIndexOf('china-song.net')>0) {webstring = '<span class="navLink_disabled">Invalid web link</span>';}		
	if (webaddr.lastIndexOf('tmphotography.zoomshare.com')>0) {webstring = '<span class="navLink_disabled">Invalid web link</span>';}		
	if (webaddr.lastIndexOf('ausmodels.com')>0) {webstring = '<span class="navLink_disabled">Invalid web link</span>';}		
	
					
return webstring;
}
// *******************************************************************
function StarRate(joindate, lastup, linkout, memphotos)
{
var stars = 0;

// Join Date: worth up to 1.0 stars
today = new Date();
var one_day=1000*60*60*24
var joinyear  = joindate.substring(0, 4);
var joinmonth = joindate.substring(5, 7)-1;
var joinday   = joindate.substring(8, 10);
var joindatefull =new Date(joinyear, joinmonth, joinday)
var joinago = Math.round((today.getTime()-joindatefull.getTime())/(one_day)-1);
if (joinago > 29)  {stars = stars + 0.25;}  // 30 days 0.25
if (joinago > 59)  {stars = stars + 0.25;}  // 60 days 0.5
if (joinago > 119) {stars = stars + 0.25;}  // 4 months 0.75
if (joinago > 364) {stars = stars + 0.25;}  // 1 year  1.0

// last update worth up to 0.5 stars
var lastupyear  = lastup.substring(0, 4);
var lastupmonth = lastup.substring(5, 7)-1;
var lastupday   = lastup.substring(8, 10);
var lastupfull  = new Date(lastupyear, lastupmonth, lastupday)
var lastupdatedays = Math.round((today.getTime()-lastupfull.getTime())/(one_day)-1);
if (lastupdatedays < 20) {stars = stars + 0.25;}  // 20 days 0.25
if (lastupdatedays < 7)  {stars = stars + 0.25;}  // 7 days 0.5

// linkout worth up to 1.0 stars
if (linkout > 0) {stars = stars + 0.25;}  // 1 link  0.25
if (linkout > 2) {stars = stars + 0.25;}  // 3 links 0.5
if (linkout > 4) {stars = stars + 0.25;}  // 5 links 0.75
if (linkout > 7) {stars = stars + 0.25;}  // 8 links 1.0

// memphotos worth up to 1.5 stars
if (memphotos > 4 )  {stars = stars + 0.25;}  // 5  photos 0.25
if (memphotos > 7 )  {stars = stars + 0.25;}  // 8  photos 0.5
if (memphotos > 11)  {stars = stars + 0.25;}  // 12 photos 0.75
if (memphotos > 14)  {stars = stars + 0.25;}  // 15 photos 1.0
if (memphotos > 19)  {stars = stars + 0.25;}  // 20 photos 1.25
if (memphotos > 29)  {stars = stars + 0.25;}  // 30 photos 1.5

// Normalize from 0 to 5 in half steps
if (stars > 5) {stars = 5;}
if (stars < 0) {stars = 0;}
stars = Math.round(stars*2)/2 // round to nearest 0.5

return stars
}
				  


// *******************************************************************
//
// Popup URL window
//
function popup(id,URL,wide,high) {
	if (arguments.length < 3) { wide = 650; }		// default width if not provided
   if (arguments.length < 4) { high = 750; }		// default height
   eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=" + wide + ",height=" + high +"');");
	eval("page" + id + ".focus();");					// bring to top if buried
}

// *******************************************************************
function paytext(paypref)
{
	if (paypref.lastIndexOf(',')>0) {
	paypref = paypref.replace(',',' & ');
	}
	else {
		 paypref = paypref + ' Only'
		 }
	paypref = paypref.replace('PAID','Paid');
	return paypref;	
}
// *******************************************************************
function lastview(idnum)
{
	var today = new Date();
	var expires = 5; // set number of days here
	expires = expires * 1000 * 60 * 60 * 24;
	var expires_date = new Date( today.getTime() + (expires) );
	lastlist = init_array();
	var lastlist= new Array(11); 
		
	get_array('lastview', lastlist);
	for (var i = 1; i <= 11; i++) {
	if (lastlist[i] == undefined) {lastlist[i] = 1;}
	}
	
	var zindex = lastlist[11];
	
	var found = false;
	for (i = 1; i <= 10; i++)
	{
	if (lastlist[i] == idnum) {found = true;}
	}
	
	if (found == false) 
	{
	zindex++;
	if (zindex > 10) {zindex = 1;};
	lastlist[zindex] = idnum;
	}
	lastlist[11] = zindex;
	set_array('lastview', lastlist, expires_date);
	return null;
}

// *******************************************************************


// Popup calendar window
//
function ShowCal(date,field) {
	var w = window.open("/perl/calPopup.pl?date="+date+'&field='+field,"calendar","width=425,height=540,status=yes,resizable=yes,scrollbars");
}

// *******************************************************************

// Make a button
//
function MakeButton(text,url,alt,target) {
	if (text != '') {
		document.write('<table width="61" cellpadding="0" cellspacing="0" id="blocknav"><tr><td align="center"><a href="' + url + '"');
	   if (arguments.length >= 3) { document.write(' alt="'    + alt    + '"');		}
		if (arguments.length >= 4) { document.write(' target="' + target + '"'); 	}
	   document.write('class="table_btn">' + text +'</a></td></tr></table>');
	}
}
// *******************************************************************
	
function WPtext(workp)	{
workp = workp.replace('{','');
workp = workp.replace('}','');
workp = workp.replace('HS',' Headshot');
workp = workp.replace('CA',' Casual');
workp = workp.replace('RF',' Runway');
workp = workp.replace('SF',' Sport');
workp = workp.replace('SW',' Swim');
workp = workp.replace('GL',' Glamour');
workp = workp.replace('LI',' Lingerie');
workp = workp.replace('CI',' Implied Nude');
workp = workp.replace('SS',' Sheer');
workp = workp.replace('TO',' Topless');
workp = workp.replace('AN',' Artistic Nude');
workp = workp.replace('NU',' Nude');
return workp;
}

		
// *******************************************************************

function Eyetext(eyet)	{
eyet = eyet.replace('{','');
eyet = eyet.replace('}','');
eyet = eyet.replace('HZL','Hazel');
eyet = eyet.replace('BLU','Blue');
eyet = eyet.replace('GRN','Green');
eyet = eyet.replace('BRN','Brown');
eyet = eyet.replace('BLK','Black')
eyet = eyet.replace('GRY','Grey');

return eyet;
}

		
// *******************************************************************


function PhotoCountImage(count) {
	var pcimage = '<img src="/images/icons/photo_cnt3.gif" alt="Minimal Photos" width="100" height="29">';
	if (count >= 6) {pcimage = '<img src="/images/icons/photo_cnt6.gif" alt="4 or more photos" width="100" height="29">';}
	if (count >= 10) {pcimage = '<img src="/images/icons/photo_cnt10.gif" alt="10 or more photos" width="100" height="29">';}
	if (count >= 20) {pcimage = '<img src="/images/icons/photo_cnt20.gif" alt="20 or more photos" width="100" height="29">';}
	if (count >= 30) {pcimage = '<img src="/images/icons/photo_cnt30.gif" alt="30 or more photos" width="100" height="29">';}
return pcimage;
}
// *******************************************************************

function GenderSymbol(symbol) {
	if (symbol == 'M') {gsymbol = '<img src="/images/icons/male.gif" width="16" height="16" hspace="4">';}
	else{ gsymbol = '<img src="/images/icons/female.gif" width="16" height="16" hspace="4">';}
	return gsymbol
}
// *******************************************************************
function FeatureReason(lastup, photos, gals, views){
	var reason = '<img src="/images/icons/feature0.gif" width="80" height="8">';
	
	var lastupyear  = lastup.substring(0, 4);
	var lastupmonth = lastup.substring(5, 7)-1;
	var lastupday   = lastup.substring(8, 10);
	
	Today = new Date();
	var yr =   Today.getFullYear();
	var mnth = Today.getMonth(); //Month is 0-11 in JavaScript
	var dy =   Today.getDate();
	
	var one_day=1000*60*60*24
	
	var lastupfull =new Date(lastupyear, lastupmonth, lastupday); // This is the day of the update at midnight
	var tdayfull   =new Date(yr, mnth, dy); // This is today at midnight
	
	var lastupdatedays = Math.round((tdayfull.getTime()-lastupfull.getTime())/(one_day));
	
	if (lastupdatedays < 11 ) {reason = '<img src="/images/icons/newlyupdated.gif" width="80" height="8">';}
	
	if (views > 200) {reason = '<img src="/images/icons/200views.gif" width="80" height="8">';}
	
	if (gals > 1) {reason = '<img src="/images/icons/multiplegals.gif" width="80" height="8">';}
	
	if (photos > 19) {reason = '<img src="/images/icons/lotsphotos.gif" width="80" height="8">';}
	
	if (views > 1000) {reason = '<img src="/images/icons/1000views.gif" width="80" height="8">';}
	
	if (views > 5000) {reason = '<img src="/images/icons/5000views.gif" width="80" height="8">';}
	
	if (lastupdatedays < 7 ) {reason = '<img src="/images/icons/updateweek.gif" width="80" height="8">';}
	
	if (lastupdatedays == 0) {reason = '<img src="/images/icons/updatetoday.gif" width="80" height="8">';}

	return reason
}
// *******************************************************************
function FormatNumberBy3(num) {
    sep = ",";
    decpoint = ".";

  // need a string for operations
  num = num.toString();
  // separate the whole number and the fraction if possible
  a = num.split(decpoint);
  x = a[0]; // decimal
  y = a[1]; // fraction
  z = "";


  if (typeof(x) != "undefined") {
    // reverse the digits. regexp works from left to right.
    for (i=x.length-1;i>=0;i--)
      z += x.charAt(i);
    // add seperators. but undo the trailing one, if there
    z = z.replace(/(\d{3})/g, "$1" + sep);
    if (z.slice(-sep.length) == sep)
      z = z.slice(0, -sep.length);
    x = "";
    // reverse again to get back the number
    for (i=z.length-1;i>=0;i--)
      x += z.charAt(i);
    // add the fraction back in, if it was there
    if (typeof(y) != "undefined" && y.length > 0)
      x += decpoint + y;
  }
  return x;
}
// *******************************************************************
function ModelMeas(sex, bust, cup, waist, hips)
{
// Show cup size and hips only for female models
if (sex == 'F') {
		var meas_out = '';
		meas_out = bust+''+cup+'-'+waist+'-'+hips;
		}
		else {
		meas_out = bust+'" chest, '+waist+'" waist';
		}
		
		return meas_out;
}
// ******************************************************************

// MemberDays: How many days have they been a member?

function MemberDays(joindate)
{
	var joinyear  = joindate.substring(0, 4);
	var joinmonth = joindate.substring(5, 7)-1;
	var joinday   = joindate.substring(8, 10);
	
	Today = new Date();
	var yr =   Today.getFullYear();
	var mnth = Today.getMonth(); //Month is 0-11 in JavaScript
	var dy =   Today.getDate();
	
	var one_day=1000*60*60*24
	var one_minute=1000*60
	
	var joinfull =new Date(joinyear, joinmonth, joinday); // This is the day of the join at midnight
	var tdayfull   =new Date(yr, mnth, dy); // This is today at midnight
	
	var memberdays = Math.round((tdayfull.getTime()-joinfull.getTime())/(one_day));
	
return memberdays;
}
// ******************************************************************
function HighTab(tablename, cell)
{
			var x=document.getElementById(tablename).rows
			var y=x[0].cells
			y[cell].bgColor="#F0F0F0"
			y[cell].background="/images/bg/tabhigh.gif"
			//y[cell].style="data-required"
			return null;
}

// *******************************************************************

function LockForm(formname) 
{
for (i = 0; i < formname.length; i++) {
var tempobj = formname.elements[i];
tempobj.disabled = true;
}
return null;
}
// *******************************************************************
function SelectAll(id)
{
    document.getElementById(id).focus();
    document.getElementById(id).select();
}
// *******************************************************************

function ClipBoard() 
{
holdtext.innerText = copytext.innerText;
Copied = holdtext.createTextRange();
Copied.execCommand("Copy");
}

// *******************************************************************


// *******************************************************************