// Global Vars
var av_ref;
var site_id;
var performers;
var online_performers;
var new_performers;
var picks_performers;
var top_performers;
var att = null;
// ** 

Attribute=function (id,name,default_value_id,att_type,type_info,eng_name) {
 this.id=id;
 this.name=name;
 this.default_value_id=default_value_id;
 this.att_type=att_type;
 this.type_info=type_info; 
 this.eng_name = eng_name;
}

User=function () {
  var show_icon = 'regular';
  var user_id;
	var site_id;  
	var balance;
	var user_type;
}

User.prototype.writeEditableAttributes = function(att_list) {
  document.write('<table cellpadding="0" cellspacing="3" border="0">');
  if(!att_list) return;
  for( var key in att_list) {
		if(att_list[key] == "show_icon") {
			document.write("<input type=hidden name='att_id' value='115'>");
			document.write("<input type=hidden name='value_115' value=''>");
			document.write("<select name='val_id_115'><option value='1'>Regular</option><option value='0'");
			if(this.show_icon=='vip') document.write(" SELECTED");
			document.write(">VIP</option></select>");
    }
}}

function get_user() {
  if(active_user != null)
	  return active_user;
	else
		return new User();
}

Attribute.prototype.getEditableHtml = function(value_id_ar, type_info) {
	var val_ar = value_id_ar;
	var att_id = this.id;
	var ref = av_ref;
	var retStr = "";
  var this_type_info = type_info;

if(!val_ar || val_ar == null) {	val_ar = new Array(0);	}

	if(!this_type_info)
		this_type_info = this.type_info;
  if(this.att_type != 'IMAGE_FILE')
      retStr += ("<input type=hidden name='att_id' value='"+att_id+"'>");
  if (this.att_type == 'SELECT' || this.att_type == 'RATE' || this.att_type == 'CHECKBOX') {
      var multiple = eval(unpackTypeInfo(this_type_info,0,'false'));
      var size = unpackTypeInfo(this_type_info,1,'1');
			var pref_txt = unpackTypeInfo(this_type_info,2,null);
			var pref_val = unpackTypeInfo(this_type_info,3,'');
 		  if(this.att_type == 'CHECKBOX') { //TEMP, USE MULTIPLE SELECTS FOR CHECKBOXES
				multiple = true;
				size = 5;
      }
      retStr += ("<input type=hidden name='value_"+att_id+"' value=''>");
 
      retStr += ("<select name='val_id_"+att_id+"' "+ ((size > 1)?"size="+size+" ":"")+ ((multiple)?"MULTIPLE":"")+">");
			if(pref_txt) 
				retStr += "<option value='"+pref_val+"'>"+pref_txt+"</option>";
      var all_vals = ref.getAllAttributeValues(att_id);

      var val_st = ":"+val_ar.join(":")+":";
      for(var i in all_vals) {
        var selected = (val_st.indexOf(":"+i+":") > -1);
        var t = "<option value='"+(i)+"' "+(selected?"SELECTED":"")+">"+(all_vals[i])+"</option>";
        retStr += (t);
      }

      retStr += ("</select>");
    }
    if (this.att_type == 'TEXTAREA') {
      var rows = unpackTypeInfo(this_type_info,0,'3');
      var cols = unpackTypeInfo(this_type_info,1,'30');
      //alert(val_ar[0]+" "+att_id);
      retStr += ("<input type=hidden name='att_id' value='"+att_id+"'>");
      retStr += ("<input type=hidden name='val_id_"+att_id+"' value='"+val_ar[0]+"'>");
      retStr += ("<textarea cols='"+cols+"' rows='"+rows+"' name='value_"+att_id+"'>"+ref.getValue(att_id,val_ar[0])+"</textarea>");
    } if (this.att_type == 'TEXT') {
      var size = unpackTypeInfo(this_type_info,0,'20');
      retStr += ("<input type=text size="+size+" name='value_"+att_id+"' value='"+ref.getValue(att_id,val_ar[0])+"'>");
      retStr += ("<input type=hidden name='val_id_"+att_id+"' value='"+val_ar[0]+"'>");
    } if (this.att_type == 'SKIN_SELECT') {
      retStr += ("<Table><tr>");
      var count = 0;
      var all_vals = ref.getAllAttributeValues(att_id);
      for(var i in all_vals) {
        if(count == 3) {
          retStr += ('</tr><tr>');
         count = 0;
        }
        var selected = "";
        if(i == val_ar[0]) selected = " CHECKED";
        var tt = all_vals[i];
        retStr += ('<TD><IMG src="/performers/skin_thumbs/thumb_'+ tt.substring(0,tt.indexOf(".")) +'.jpg"><br>');
        retStr += ('<INPUT type="radio" name="val_id_'+att_id+'" value="'+i+'" '+selected+'></TD>');
        count++;
      }
      retStr += ("</tr></table>");
    } if (this.att_type == 'IMAGE_FILE') {
      retStr += ("<IMG src='"+ref.getValue(att_id,val_ar[0])+"'>");
    } if (this.att_type == 'FILE') {
      var size = '60';
      retStr += ("<input type=text name='value_"+att_id+"' size="+size+" value='"+ref.getValue(att_id,val_ar[0])+"'>");
      retStr += ("<input type=hidden name='val_id_"+att_id+"' value='"+val_ar[0]+"'>");
    }
	return retStr;
}

AttributeValueRef=function () {
 this.att=new Object();
 this.val=new Object();
 this.attRev=new Object();
}
AttributeValueRef.prototype.addAttribute=function (attribute_id, attribute) {
 this.att[attribute_id] = attribute;
 this.attRev[attribute.eng_name.toUpperCase()] = attribute_id;
}
AttributeValueRef.prototype.A=function (attribute_id, attribute) { this.addAttribute(attribute_id, attribute); }
AttributeValueRef.prototype.addValue=function (attribute_id, value_id, value) {
 if(!this.val[attribute_id]) this.val[attribute_id] = new Array;
 this.val[attribute_id][value_id] = value;
}
AttributeValueRef.prototype.V=function (attribute_id, value_id, value) { this.addValue(attribute_id, value_id, value); }
AttributeValueRef.prototype.getAttribute=function (attribute_id) {
 return this.att[attribute_id];
}
AttributeValueRef.prototype.getAttributeIdByName=function(attribute_name) {
 return this.attRev[attribute_name.toUpperCase()];
}
AttributeValueRef.prototype.getValue=function (attribute_id, value_id) {
 if(!this.val[attribute_id] || !this.val[attribute_id][value_id])
	return "";
 return this.val[attribute_id][value_id];
}
AttributeValueRef.prototype.getAllAttributeValues=function (attribute_id) {
 return this.val[attribute_id];
}

av_ref = new AttributeValueRef();

PerformerAttributes=function (attribute_value_map) {
  this.ref = av_ref; // reference to global AttributeValueRef obj 
  this.map = new Object(); // maps attribute_id to array of value_ids
}

ValueList=function(attribute_id,value_id_array) {
	this.att_id = attribute_id;
	this.values = this.filter(av_ref,attribute_id,value_id_array);
	this.val_ids = value_id_array;
}
ValueList.prototype.toString= function() {if(this.values[0]) return this.values[0]; return "";}
ValueList.prototype.filter= function(attValRef,att_id,val_id_ar) {
	var ret = new Array;
	for(var i = 0; i < val_id_ar.length; i++) { ret[i]=attValRef.getValue(att_id,val_id_ar[i]); }
	return ret;
}

Photo=function(photo) { this.photo=photo; }

Performer=function (username, user_id, reg_date) {
 this.username=username;
 this.user_id=user_id;
 this.photos=new Array;
this.atts=new PerformerAttributes (av_ref);
 this.lang = false;
 this.reg_date = new Date(reg_date);

// for optimizations (DSL 8.12.04)
this.vals = new Array;
}
// Add attribute values to a performer
// NOTE: this sets multiple values for the same att to a comma separated list
Performer.prototype.addAtt=function(attName,attValue) {
  var val = "";
  if(this.vals[attName] != null)
  	val = this.vals[attName] + ",";
  this.vals[attName] = val + attValue;
}
Performer.prototype.getAtt=function(attName) {

var ret = this.vals[attName];
if(ret == null || ret == 'undefined')
        ret = "";

  return ret;
}

Performer.prototype.toString=function () { return this.username; }
Performer.prototype.addPhoto=function (photo) { this.photos[this.photos.length]=photo; }
Performer.prototype.getPhotos=function () { return this.photos; }
Performer.prototype.getUserId = function() { return this.user_id; }
Performer.prototype.a=function (attribute_id,value_id) { this.addAttributeValue(attribute_id,value_id); }
Performer.prototype.addAttributeValue=function (attribute_id,value_id) {
 with(this.atts) { 
  if(!map[attribute_id]) {
  map[attribute_id] = new Array;
   map[attribute_id][0]=value_id;
 }
  else
   map[attribute_id][map[attribute_id].length]=value_id;
 }
}
Performer.prototype.getAttValueByAttName=function(attribute_name) {
 if(attribute_name == 'live_thumbnail') {
  return '/WebArchive/'+this.username+'/thumbs/LinkedImage.jpg';
  var file = this.getAttValueByAttName('image');
  var folder = this.username;
  if(file == 'DefaultImage.jpg') {
    folder  = 'default';
    file = 'Image.jpg';
  }

  return '/WebArchive/'+folder+'/thumbs/'+file;
 } if(attribute_name == 'picture') {
  return '/WebArchive/'+this.username+'/flash/LinkedImage.jpg';
  var file = this.getAttValueByAttName('image');
  var folder = this.username;
  if(file == 'DefaultImage.jpg') {
    folder  = 'default';
    file = 'Image.jpg';
  }
  return '/WebArchive/'+folder+'/flash/'+file;
 } if(attribute_name == 'snapshot') {
  return '/WebArchive/'+this.username+'/live/LinkedImage.jpg';
  var file = this.getAttValueByAttName('image');
  var folder = this.username;
  if(file == 'DefaultImage.jpg') {
    folder  = 'default';
    file = 'Image.jpg';
  }
  return '/WebArchive/'+folder+'/live/'+file;
 }

 with(this.atts) {
  var att_id = ref.attRev[attribute_name.toUpperCase()];
		if(!att_id) {
			return "";	
		}

  var val_ids = new Array;
  if(!map[att_id] || !map[att_id][0]) {
   val_ids[0] = ref.getAttribute(att_id).default_value_id;
  }
  else
   val_ids = map[att_id];
	var ret = new ValueList(att_id,val_ids);
  if(!ret)
   ret = "";
  return ret;
 }
}

Performer.prototype.getAttributeValue=function(att_id) {
 with(this.atts) {
  var val_ids = new Array;
  if(!map[att_id] || !map[att_id][0])
   val_ids[0] = ref.getAttribute(att_id).default_value_id;
  else
   val_ids = map[att_id];
	var ret = new ValueList(att_id,val_ids);
  if(!ret)
   ret = "";
  return ret;
 }
}
Performers=function () {
 this.performers=new Array; 
 this.length = 0;
 this.lang = false;
}
performers = new Performers();
online_performers=new Performers();
new_performers = new Performers();
picks_performers = new Performers();
top_performers = new Performers();
var busy_performers = new Performers();
var free_performers = new Performers();
var private_performers = new Performers();
var private125_performers = new Performers();
var private130_performers = new Performers();
var public_performers = new Performers();


Performers.prototype.add=function (performer) {
 this.length++;
 this.performers[performer.username]=performer;
}
Performers.prototype.count=function () { document.write(this.length); }
Performers.prototype.getPerformer=function (username) {
 return this.performers[username]; }
Performer.prototype.writeAttribute=function (attribute) {
 document.write(this.getAttValueByAttName(attribute)); 
}
Performer.prototype.writeImageAttribute=function (attribute_name, width, height, alt) {
 var attribute=this.getAttValueByAttName(attribute_name);
 if (attribute!=null) document.write('<IMG src="'+attribute+'" width="'+width+'" height="'+height+'" alt="'+alt+'" border="0">'); }

function getEditableHtml(att_name,type_info) {
	var att = av_ref.getAttribute(av_ref.getAttributeIdByName(att_name));
	if(att == null) return "";
	return att.getEditableHtml(null,type_info);
}
// Veronica

function getAttributeName(att_name) {
  var att = av_ref.getAttribute(av_ref.getAttributeIdByName(att_name));
    if(att == null) return "";
      var comp = "";
      var str = att.name;
      var attname = str.replace(/（必須）/, comp+ "");
      return attname;
      }

// end Veronica

function unpackTypeInfo(str, count, default_val) {
  if(!str)
    return default_val;
  var ar = str.split(':');
  if (!ar || ar.length < count)
    return default_val;
  return ar[count];
}

// NEED TO MODIFY THIS FUNCTION TO MAKE IT BETTER--- reminder for celeste
Performer.prototype.writeAttributes=function(att_list) {
 with(this.atts) {
  //document.write('<table cellpadding="0" cellspacing="3" border="0" width="100%">');
	document.write('<td rowspan="2" align="left" bgcolor="#EBEBEB"><table border="0" cellpadding="2" cellspacing="0">');
	var joined;
	var hw;
	var br;
	if(!att_list) return;
	for( var key in att_list) {
	  
		var att_id = ref.getAttributeIdByName(att_list[key]);
		var att = ref.getAttribute(att_id);
		
		if(!att) continue;
		//document.write('<tr><td width="21%">'+att.name+'</td>');
		var val_ar = map[att_id];
		if(!val_ar) {
    	val_ar = new Array;
    	val_ar[0] = att.default_value_id ;
  	}
		
		// REMOVE "required" in JP
 		var comp = "";
		var str = att.name;
		att.name = str.replace(/（必須）/, comp+ ""); 

		// CHANGE INTO SWITCH STATEMENTS
		if(att.eng_name == 'height_x') {
			document.write('<tr><td width="25%">'+att.name+'</td>');
			hw = "<td width=79%>身長"+ ref.getValue(att_id, val_ar[0]) + " cm ";
		}	else if (att.eng_name == 'weight_x') {
			hw += " 体重 " + ref.getValue(att_id, val_ar[0]) + " kg </td>";
			document.write(hw);
		}	else if(att.eng_name == 'breast_size') {
			document.write('<tr><td width="25%">'+att.name+'</td>');
			br = "<td width=75%>バスト" + ref.getValue(att_id, val_ar[0]) + " cm ";
		}	else if(att.eng_name == 'breast_cup') {
			br += ref.getValue(att_id,val_ar[0]);
		}	else if(att.eng_name == 'waist_x') {
			br += " ウエスト " + ref.getValue(att_id, val_ar[0]) + "  cm ";
		}	else if(att.eng_name == 'hip_x') {
				br += " ヒップ " + ref.getValue(att_id, val_ar[0]) + " cm</td></tr>";
				document.write(br);
		} else if(att.eng_name == 'blood_type') {
			document.write('<tr><td width="25%">'+att.name+'</td>');
			document.write("<td width=75%>" + ref.getValue(att_id, val_ar[0]) + " 型 </td>");
		}	else if(att.eng_name == 'lost_virginity') {
			document.write('<tr><td width="25%">'+att.name+'</td>');
			document.write("<td width=75%>" + ref.getValue(att_id, val_ar[0]) + " 歳のときにバージンを失った</td>");
		} else if(att.eng_name == 'times_sex_guys') {

			document.write('<tr><td width="25%">'+att.name+'</td>');
			document.write("<td width=75%>今まで " + ref.getValue(att_id, val_ar[0]) + " 人の男性とエッチ経験がある</td></tr> ");
		}	else if(att.name == 'times_masturbate') {
			document.write('<tr><td width="25%">'+att.name+'</td>');
			document.write("<td width=79%>週に " + ref.getValue(att_id, val_ar[0]) + " 回 </td></tr>");
		}	else if(att.eng_name == 'lang_x' || att.eng_name == 'do_for_you' || att.eng_name == 'type_of_girl' || att.eng_name == 'guy_i_like' || att.eng_name == 'guy_i_dont_like' || att.eng_name == 'things_i_like' || att.eng_name == 'hobbies' || att.eng_name == 'favorite_sports' || att.eng_name == 'sex_position') {
				document.write('<tr valign=top><td width="25%">'+att.name+'</td><td width=75%>');
				for(var i=0; i<val_ar.length; i++) {
					document.write(ref.getValue(att_id, val_ar[i]) + "<br>");
				}
				document.write('</td></tr>');
		} else if(att.eng_name == 'other_plays') {
			document.write('<tr><td width="25%" nowrap>');
			document.write('　その他の可能なプレイ </td><td>');
			document.write(ref.getValue(att_id, val_ar[0]) + " </td></tr>");
		}	else {
			document.write('<tr><td width="25%">'+att.name+'</td>');
			document.write("<td width=75%>" + ref.getValue(att_id, val_ar[0])+ "</td></tr>");
		} 
  } // END OF for()
  document.write("</table>");  
 } // END OF with()

} 

Performer.prototype.writeEditableAttributes=function(att_list) {
	document.write(this.getEditableAttributes(att_list));
}

Performer.prototype.getEditableAttributes=function(att_list) {
 var str = "";
 with(this.atts) {
  var joined;
	if(!att_list) return;
	for( var key in att_list) {
	  var att_id = ref.getAttributeIdByName(att_list[key]);
		var att = ref.getAttribute(att_id);
		if(!att) continue;
    		str += "<tr><td>"+att.name+"</td><td>";
		var val_ar = null;
    if(map)
      val_ar = map[att_id];
    if(!val_ar) {
      val_ar = new Array;
      val_ar[0] = att.default_value_id;
    }
    str += att.getEditableHtml(val_ar);
    str += "</td></tr>";
  }
 }

 return str;
}

Performer.prototype.writeGallery=function (perLine, width, height) {
 var perLine=perLine;
 with (this) {
  var photos=getPhotos();
  document.writeln('<TR>');
  if (photos!=null) {
   var count=1;
   for (var photo in photos) {
    var linebreak=((count%perLine)==0);
    with (photos[photo]) {
     //document.writeln('<TD><A href="/WebArchive/'+username+'/original/'+photo+'" target="_blank"><IMG src="/WebArchive/'+username+'/thumbs/'+photo+'" width="'+width+'" height="'+height+'" alt="" border="0"></A></TD>'); 
		document.writeln('<TD><A href="http://imageup.exshot.com/WebArchive/'+username+'/original/'+photo+'" target="_blank"><IMG src="http://imageup.exshot.com/WebArchive/'+username+'/thumbs/'+photo+'" width="'+width+'" height="'+height+'" alt="" border="0"></A></TD>');
		}
    if (linebreak) document.writeln('<TR>');
    count++; } } } }

IdFilter = function(attribute_id, value_id) { // more value_ids allowed as parameters
 var att = av_ref.getAttribute(attribute_id);
 this.attribute_id = attribute_id;
 this.att_name = "none";
 this.myvalues = "";
 if(att) {
    this.att_name = att.eng_name;
 }
 for(var i = 1; i < arguments.length; i++) { 
    this.myvalues += "\t"+av_ref.getValue(attribute_id,arguments[i])+"\n";
 }
}
IdFilter.prototype.addValueId = function(value_id) {
  this.myvalues  += "\t"+av_ref.getValue(this.attribute_id,value_id)+"\n";
}

Filter = function(attribute_name, value_name) { // more value_names allowed as parameters
  this.att_name = attribute_name;
  this.myvalues = "";


  for(var i = 1; i < arguments.length; i++) {

    this.myvalues += "\t"+arguments[i]+"\n";
  }
}

Performers.prototype.filter= function(myfilter) {
  var newps = new Performers();
   for (var k in this.performers) {
    var vl = this.performers[k].getAttValueByAttName(myfilter.att_name);
    for(var j in vl.values) {
      if(myfilter.myvalues.indexOf("\t"+vl.values[j]+"\n") > -1) {
        newps.add(this.performers[k]);
        continue;
      }
    }
   }
   return newps;
}

Performers.prototype.split = function(att_name) {
  var att_id = av_ref.getAttributeIdByName(att_name);
  var att = av_ref.getAttribute(att_id);
  var perfs_arr = new Array();
  var val_ids = av_ref.getAllAttributeValues(att_id);

  for(var k in val_ids) { perfs_arr[k] = new Performers(); }

   for (var k in this.performers) {
    var val_ids = this.performers[k].getAttributeValueId(att.id);
    if(val_ids) {
    for(var j in val_ids) {
      if(val_ids[j]) {
        perfs_arr[val_ids[j]].add(this.performers[k]);
      }
    }
}
   }
   return perfs_arr;
}

Category=function (id,name) {
 this.id=id;
 this.name=name;
 this.performers=new Array; }

Category.prototype.add=function (performer) {
 this.performers[this.performers.length]=performer; }

Categories=function () {
 this.categories=new Array; }

Categories.prototype.getIdList = function() {
	var ret = new Array;
	this.categories.sort(catComp);
	for(var category in this.categories) {
		ret[ret.length]=this.categories[category].id;
	}
	return ret;
}

Categories.prototype.getNameList = function() {
	var ret = new Array;
	this.categories.sort(catComp);
	for(var category in this.categories) {
		ret[ret.length]=this.categories[category].name;
	}
	return ret;
}

function catComp(a, b) {
  if(a.id < b.id) return -1;
  if(b.id < a.id) return 1;
  return 0;
}

Categories.prototype.add=function (category) {
 this.categories[this.categories.length]=category; }

Categories.prototype.get=function (id) {
  for (var category in this.categories) {
  if (this.categories[category].id==id) return this.categories[category]; }
 return null; }

Categories.prototype.getPerformerCount=function(id) {
	var cat=this.get(id);
	if(cat == null) return 0;
	return cat.performers.length;
}

Categories.prototype.writePerformerCount=function (id) {
  document.write(getPerformerCount(id)); }
	
Categories.prototype.fill=function (performers, attribute) {
if(!attribute) attribute = 'category';
 var seen=new Array;
 with (performers) {
  for (var performer in performers) {
   var id_vl=performers[performer].getAttValueByAttName(attribute);
   for(var vid in id_vl.val_ids) {
    var id = id_vl.val_ids[vid];
    if (id==null) continue;
    if (id=='') continue;
    if (seen[id]!=1) {
      this.add(new Category(id,id_vl.values[vid]));
      seen[id]=1;
    }
    var category=this.get(id);
    if (category==null) continue;
    category.add(performers[performer]); } } } }

Configuration=function () {
 this.Ip='';
 this.Server='';
 this.Copyright='';
 this.Language=''; 
 this.VName='';
 this.VPass='';
}

function writePerformersChat (document, performer, configuration) {
 var login = "";
 if(configuration.VName != '') {
	login = "&user_arg="+configuration.VName+"&pass_arg="+configuration.VPass;
 }
 var st = '<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="760" height="420" id="video_chat" align="">';
 st += ('<PARAM name="movie" value="/flash/video_chat_13_2way.swf?performerMode_arg=210&skin_arg=/flash/skin_sea.swf&ip_arg='+configuration.Ip+'&photo_arg='+performer.getAttValueByAttName('picture')+'&langId_arg='+configuration.Language+login+'">');
 st += ('<PARAM name="loop" value="false">');
 st += ('<PARAM name="menu" value="false">');
 st += ('<PARAM name="quality" value="high">');
 st += ('<EMBED src="/flash/video_chat_13_2way.swf?performerMode_arg=210&skin_arg=/flash/skin_sea.swf&ip_arg='+configuration.Ip+'&photo_arg='+performer.getAttValueByAttName('picture')+'&langId_arg='+configuration.Language+login+'" quality="high" bgcolor="#000000" width="760" height="420" name="video_chat" align="" type="application/x-shockwave-flash" pluginspace="http://www.macromedia.com/go/getflashplayer"></EMBED>');
 st += ('</OBJECT>');
 document.write(st);
}

function writeViewerTextChat (document, performer, configuration,viewerMode) {
 var login = "";
 var bst = ""; 
 if(checkTextBan(performer.username)) bst = "&ban_arg=true";
 if(checkTextKick(performer.username)) bst = bst + "&kick_arg=true";

 if(configuration.VName != '') {
	login = "&user_arg="+configuration.VName+"&pass_arg="+configuration.VPass;
 }
 document.writeln('<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="455" height="300" id="video_chat" align="">');
 document.writeln('<PARAM name="movie" value="/flash/text_chat.swf?performerMode_arg='+ viewerMode + '&performer_arg='+ performer + '&ip_arg='+configuration.Ip+'&server_arg='+configuration.Server+'&langId_arg='+configuration.Language+login+bst+'">')
 document.writeln('<PARAM name="loop" value="false">');
 document.writeln('<PARAM name="menu" value="false">');
 document.writeln('<PARAM name="quality" value="high">');
 document.writeln('<PARAM name="bgcolor" value="#000000">');
 document.writeln('<EMBED src="/flash/text_chat.swf?performerMode_arg='+ viewerMode + '&performer_arg=' + performer + '&ip_arg='+configuration.Ip+'&server_arg='+configuration.Server+'&langId_arg='+configuration.Language+login+bst+'" quality="high" bgcolor="#000000" width="455" height="300" name="text_chat" align="" type="application/x-shockwave-flash" pluginspace="http://www.macromedia.com/go/getflashplayer"></EMBED>');
 document.writeln('</OBJECT>'); }


function writeViewersChat (document, performer, configuration, mode_str, points) {
 var bst = ""; 
 if(checkBan(performer.username)) bst = "&ban_arg=true";
 if(busy_performers.getPerformer(performer.username)) bst += "&busy_arg=true";
 if(!mode_str) mode_str = 'public';

  var mode = '&viewer_mode_arg=' + mode_str;
 var points_str = points;

// var mode_str = checkViewerMode();

 /*if (mode_str == 'Chat Mode') {
 	mode += 'public';
 } else if (mode_str == 'Peep Mode') {
 	mode += 'ROM';
 }*/
 bst += mode;


	// FOR EXSHOT PROMO
  var usr = get_user().site_id;
	bst += '&user_site_id='+usr;
  bst += '&promo_points='+points_str;

 var login = "";
 if(configuration.VName != '') {
	login = "&user_arg="+configuration.VName+"&pass_arg="+configuration.VPass;
 }

 document.writeln('<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="100%" height="100%" id="video_chat" align="">');
 document.writeln('<PARAM name="movie" value="/flash/video_chat_13_2way.swf?user_mode_arg=205&performer_arg='+performer+'&skin_arg=/flash/skin_sea.swf&ip_arg='+configuration.Ip+'&photo_arg='+performer.getAttValueByAttName('picture')+'&copyright_arg='+configuration.Copyright+'&server_arg='+configuration.Server+'&langId_arg='+configuration.Language+bst+login+'">')
 document.writeln('<PARAM name="loop" value="false">');
 document.writeln('<PARAM name="menu" value="false">');
 document.writeln('<PARAM name="quality" value="high">');
 document.writeln('<PARAM name="bgcolor" value="#000000">');
 document.writeln('<EMBED src="/flash/video_chat_13_2way.swf?user_mode_arg=205&performer_arg='+performer+'&skin_arg=/flash/skin_sea.swf&ip_arg='+configuration.Ip+'&photo_arg='+performer.getAttValueByAttName('picture')+'&copyright_arg='+configuration.Copyright+'&server_arg='+configuration.Server+'&langId_arg='+configuration.Language+bst+login+'" quality="high" bgcolor="#000000" width="100%" height="100%" name="video_chat" align="" type="application/x-shockwave-flash" pluginspace="http://www.macromedia.com/go/getflashplayer"></EMBED>');
 document.writeln('</OBJECT>'); }


// FOR J2EE System Preview for Affils
function writeFreeChat2 (document, performer, configuration) {

 var bst = ""; 

 var sess;

 if(checkBan(performer.username)) bst = "&ban_arg=true";

 if(busy_performers.getPerformer(performer.username)) sess = 115;

 else sess = 110;

 var joinLink = "https://www5.dtiserv3.com/cgi-bin/d2pjoin.fcgi?goods_id=20008317";

 var FlashVars = 'channel='+performer.username+'&performerID='+performer.user_id+'&userType=&sessionType='+sess+'&langID=jp&webID=A&userSiteID=1001343&skinName=skin0&ban=0&photo=http://imageup.exshot.com/WebArchive/'+performer.username+'/flash/LinkedImage.jpg&timeLimit=60000&timeOutLink='+joinLink; 

 document.writeln('<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="320" height="240" id="video_chat" align="">');

 document.writeln('<param name="allowScriptAccess" value="sameDomain" />')

 document.writeln('<PARAM name="movie" value="/flash/chat/limitedFreePreview20.swf">');

 document.writeln('<param name=FlashVars value="'+FlashVars+'" />');

 document.writeln('<PARAM name="salign" value="LT">');

 document.writeln('<PARAM name="quality" value="high">');

 document.writeln('<PARAM name="bgcolor" value="#006666">');

 document.writeln('<embed src="/flash/chat/limitedFreePreview20.swf" salign="LT" FlashVars="'+FlashVars +'" quality="high" bgcolor="#006666" width="320" height="240" name="video_chat" align="" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />');

 document.writeln('</OBJECT>'); }



function writeFreeChat (document, performer, configuration) {
 var bst = ""; 
 if(checkBan(performer.username)) bst = "&ban_arg=true";
 if(busy_performers.getPerformer(performer.username)) bst += "&busy_arg=true";
 
 document.writeln('<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="320" height="240" id="video_chat_free" align="">');
 document.writeln('<PARAM name="movie" value="/flash/live_12.swf?performer_arg='+performer+'&ip_arg='+configuration.Ip+'&copyright_arg='+configuration.Copyright+'&server_arg='+configuration.Server+'&langId_arg='+configuration.Language+'&photo_arg='+performer.getAttValueByAttName('picture')+bst+'">');
 document.writeln('<PARAM name="loop" value="false">');
 document.writeln('<PARAM name="menu" value="false">');
 document.writeln('<PARAM name="quality" value="high">');
 document.writeln('<PARAM name="bgcolor" value="#000000">');
 document.writeln('<EMBED src="/flash/live_12.swf?performer_arg='+performer+'&photo_arg='+performer.getAttValueByAttName('picture')+'&ip_arg='+configuration.Ip+'&copyright_arg='+configuration.Copyright+'&server_arg='+configuration.Server+'&langId_arg='+configuration.Language+bst+'" quality="high" bgcolor="#000000" width="320" height="240" name="video_chat" align="" type="application/x-shockwave-flash" pluginspace="http://www.macromedia.com/go/getflashplayer"></EMBED>');
 document.writeln('</OBJECT>'); }

function writeMemberFreeChat (document, performer, configuration) {
 var bst = "";
 if(checkBan(performer.username)) bst = "&ban_arg=true";
 if(busy_performers.getPerformer(performer.username)) bst += "&busy_arg=true";

 document.writeln('<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="320" height="240" id="video_chat_free" align="">');
 document.writeln('<PARAM name="movie" value="/viewers/live_member.swf?performer_arg='+performer+'&ip_arg='+configuration.Ip+'&copyright_arg='+configuration.Copyright+'&server_arg='+configuration.Server+'&langId_arg='+configuration.Language+'&photo_arg='+performer.getAttValueByAttName('picture')+bst+'">');
 document.writeln('<PARAM name="loop" value="false">');
 document.writeln('<PARAM name="menu" value="false">');
 document.writeln('<PARAM name="quality" value="high">');
 document.writeln('<PARAM name="bgcolor" value="#000000">');
 document.writeln('<EMBED src="/viewers/live_member.swf?performer_arg='+performer+'&photo_arg='+performer.getAttValueByAttName('picture')+'&ip_arg='+configuration.Ip+'&copyright_arg='+configuration.Copyright+'&server_arg='+configuration.Server+'&langId_arg='+configuration.Language+bst+'" quality="high" bgcolor="#000000" width="320" height="240" name="video_chat" align="" type="application/x-shockwave-flash" pluginspace="http://www.macromedia.com/go/getflashplayer"></EMBED>');
 document.writeln('</OBJECT>'); }

function writePerformersRecorder (document, performer, configuration) {
 var st = '<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="700" height="550" id="video_record" align="">';
 st += ('<PARAM name="movie" value="/flash/video_record.swf?performerMode_arg=210&skin_arg=/flash/'+performer.getAttValueByAttName('skin')+'&ip_arg='+configuration.Ip+'&photo_arg='+performer.getAttValueByAttName('picture')+'&langId_arg='+configuration.Language+'">');
 st += ('<PARAM name="loop" value="false">');
 st += ('<PARAM name="menu" value="false">');
 st += ('<PARAM name="quality" value="high">');
 st += ('<EMBED src="/flash/video_record.swf?performerMode_arg=210&skin_arg=/flash/'+performer.getAttValueByAttName('skin')+'&ip_arg='+configuration.Ip+'&photo_arg='+performer.getAttValueByAttName('picture')+'&langId_arg='+configuration.Language+'" quality="high" bgcolor="#000000" width="760" height="420" name="video_chat" align="" type="application/x-shockwave-flash" pluginspace="http://www.macromedia.com/go/getflashplayer"></EMBED>');
 st += ('</OBJECT>');
 document.write(st);
}

function writeVideoPlayer (document, performer, configuration) {

 document.writeln('<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="100%" height="100%" id="video_player" align="">');
 document.writeln('<PARAM name="movie" value="/flash/video_free_player.swf?performer_arg='+performer+'&ip_arg='+configuration.Ip+'&copyright_arg='+configuration.Copyright+'&server_arg='+configuration.Server+'&langId_arg='+configuration.Language+'&photo_arg='+performer.getAttValueByAttName('picture')+'">');
 document.writeln('<PARAM name="loop" value="false">');
 document.writeln('<PARAM name="menu" value="false">');
 document.writeln('<PARAM name="quality" value="high">');
 document.writeln('<PARAM name="bgcolor" value="#000000">');
 document.writeln('<EMBED src="/flash/video_free_player.swf?performer_arg='+performer+'&photo_arg='+performer.getAttValueByAttName('picture')+'&ip_arg='+configuration.Ip+'&copyright_arg='+configuration.Copyright+'&server_arg='+configuration.Server+'&langId_arg='+configuration.Language+'" quality="high" bgcolor="#000000" width="100%" height="100%" name="video_player" align="" type="application/x-shockwave-flash" pluginspace="http://www.macromedia.com/go/getflashplayer"></EMBED>');
 document.writeln('</OBJECT>'); }

function openVideoPlayer(){
 window.open('video_player.html?'+performer,'player','width=320,height=240,resizable=no,scrollbars=no');
}

function openLaunchViewer (performer) {
 openAppWindow('preview.html?'+performer, 'preview', 680, 383); }

function openPfProfile (performer) {
 openAppWindow('pf_profile.shtml?'+performer, performer+'_prof', 750, 570, 'width=570, scrollbars=yes, resizable=yes,toolbar=yes,location=yes'); }

function openThumbnailWindow (performer) {
 var mode = chk_auth();
  if(mode == 'false') {
   openLaunchViewer(performer);
  } else {
   openViewersChatFS(performer);
 }
 //openAppWindow('/thumbnail_link.shtml?'+performer, performer, 680, 383); 
}

function openThumbnailWindowROM (performer) {
 var mode = chk_auth();
  if(mode == 'false') {
   openLaunchViewer(performer, 'ROM');
  } else {
   openViewersChatFS(performer, 'ROM');
 }
 //openAppWindow('/thumbnail_link_ROM.shtml?'+performer, performer, 760, 460);
}


function openViewersChatFS (performer,chat_mode) {
// var winconfig = "left=0, Top=0, width=" + screen.width + ", height=" + screen.height + ", menubar=0, resizable=yes, toolbar=0, scrollbars=0, status=0"; 
// openAppWindow('/viewers/vc_frameset.html?'+performer, performer, 0, 0, winconfig); 

 openAppWindow('/viewers/vc_frameset.html?pf='+performer+'&chat_mode=' + chat_mode, performer+'Chat', 760, 520); 
}

function openViewersChat (performer,chat_mode) {
// var winconfig = "left=0, Top=0, width=" + screen.width + ", height=" + screen.height + ", menubar=0, resizable=yes, toolbar=0, scrollbars=0, status=0"; 
// openAppWindow('/viewers/vc_interface.html?'+performer, performer, 0, 0, winconfig); 

 openAppWindow('/viewers/vc_interface.html?pf='+performer+'&chat_mode=' + chat_mode, performer+'Chat', 760, 520); 
}


function openPerformersChat (w, h) {
 openAppWindow('/performers/vc_performer.html', '', w, h, 'resizable=yes, toolbar=no, scrollbars=no, personalbar=no, menubar=no, width='+w+',height='+h); }

function openLaunchFree (username) {
 if(document.location.href.indexOf('affiliate_id=') != -1 || 
    (self.parent.window.name != 'dxFreeView' && window.name != 'dxFreeView')) {
  var window_handle = window.open('launch_free.html?'+username, 'dxFreeView', 'toolbar=no, scrollbars=yes, personalbar=no, menubar=no, width=760, height=600');
  window_handle.focus();
  window_handle.setTimeout('window.close()',600000);
  window_handle.opener = self;
 } else {
  self.opener = null;
  window.top.document.location.href='launch_free.html?'+username;
 }
 return false; 
}

function openAppWindow(url, name, width, height, wincfg) {
	if(!wincfg) wincfg = 'resizable=yes, toolbar=no, scrollbars=no, personalbar=no, menubar=no, width='+width+', height='+height;
	var w = window.open(url,name,wincfg);
	w.focus();
}

function vc_reload() { location.reload(); }

function randomizeOrder(a, b) {
  return Math.random() - .5;
}

/** CLEAN THIS UP IN HTML AND DELETE **/
/** switch to performers.list(perLine) **/
function list_online(performers, perLine) {
 var perLine=perLine;
 performers.list(perLine);
}

function list_rankings(performers, perLine) {
 var perLine=perLine;
 performers.list_rank(perLine);
}

Performers.prototype.list_rank = function(perLine, popUrl, popName, popWidth, popHeight) { 
	
	if(!popUrl) {
		var popUrl = "preview.html";
		var popName	= "exFreeView";
		var popWidth	= 760;
		var popHeight	= 600;
		var winconfig	= false;

		if(document.location.href.indexOf('/viewers/') != -1 ) {
			popUrl = "preview.html";
			popName = '';
			winconfig = "left=0, Top=0, width=" + screen.width + ", height=" + screen.height + ", menubar=0, resizable=yes, toolbar=0, scrollbars=0, status=0"; 
		}
		var url = popUrl;
		var wname = popName;

		with(this) {
 			if(length) {
				var count = 1;
				var keys = new Array();
				var i = 0;
				for(var perf in performers) {
					keys[i++] = perf;
				} 
				document.writeln('<tr>');
				// GO THROUGH ALL PERFORMERS
				for(i=0; i < keys.length; i++) {
					var linebreak = ((count%perLine) == 0);
					var k = keys[i];
					
					with(performers[k]) {
						if(popUrl.indexOf('?') == -1) url = popUrl + "?" + username;
						if(popName == '') wname = username;
						
						// PROFILE 
						document.writeln('<td width="84" valign="top">');
						document.writeln('<a href="#" onClick="javascript:openPfProfile('+username + ')">');
						document.writeln('<img src="http://imageup.exshot.com' + getAttValueByAttName('live_thumbnail') + '" width="80" height=60" border="0" align="top"></a></td>');


						// FLAGS
						document.writeln('<td class="ss">');
						if(this.lang) {
							var vl = getAttValueByAttName('lang_x');
							var vc = 0;
							for(vid in vl.val_ids) {
								if(flag_files[vl.val_ids[vid]-1]) {
									vc += 1;
									if(vc < 4)
										document.write("<img src='images/icons/" + flag_files[vl.val_ids[vid]-1]+"'width=13 height=9>");
								}
							}
							document.writeln('<br>');
						}
					
						// USERNAME and AGE
						document.writeln(username);
						if(getAttValueByAttName('age_x') != '') {
							document.writeln('(');
							document.writeln(getAttValueByAttName('age_x'));
							document.writeln(')');
  					}
						document.writeln('<br>');
							
						// MIC, CAMERA, TOY
						if(this.icons) {
							if(this.lang) document.write("<br>");
							var cam = (getAttValueByAttName('has_hires') == 'Yes');
							var mic = (getAttValueByAttName('has_mic') == 'Yes');
							var toy = (getAttValueByAttName('has_toy') == 'Yes');
							if(cam) 
								document.write('<img src="images/icons/Aicon_hicamera.gif" width="13" height="13" align="absmiddle">');	
							if(mic) 
								document.write('<img src="images/icons/Aicon_mike.gif" width="13" height="13" align="absmiddle">');
							if(toy) document.write('<img src="images/icons/Aicon_adulttoy.gif" width="13" height="13" align="absmiddle">'); document.write('<br>'); 
						}
 

						
						// HORNY LEVEL - CHANGE TO SWITCH STATEMENT OR FOR LOOP
						var vl = getAttValueByAttName('horny_level');
						if(vl != '') {
							document.write("<img src='images/icons/H_level_" + vl.val_ids + ".gif' width=49 height=10 border=0><br>");
						}

						// BUST-WAIST-HIP
						document.writeln(getAttValueByAttName('breast_size'));
						if(getAttValueByAttName('breast_cup') != '') {
							document.writeln('(');
							document.writeln(getAttValueByAttName('breast_cup'));
							document.writeln(')');
						}
						if(getAttValueByAttName('waist_x') != '') {
							document.writeln(getAttValueByAttName('waist_x'));
						}
						if(getAttValueByAttName('hip_x') != '') {
							document.writeln('-');
							document.writeln(getAttValueByAttName('hip_x'));
						}
						if(online_performers.getPerformer(username)){
						 	document.writeln('<br><A href="javascript:;" onClick="openThumbnailWindow('+username+')"><img src="images/icons/online.gif" border="0" vspace="5"></A></td>');
						}	else{
						 document.writeln('<br>');
						 document.writeln('<a href="#" onClick="javascript:openPfProfile('+ username + ')">');
						 document.writeln('<img src="images/icons/b_profile.gif" width="46" height="11">');
						 document.writeln('</a></td>');
						}
					}
					if(linebreak) {
						document.writeln('</tr><tr>');
						document.writeln('<td colspan="2" class="ss"> <img src="images/navi_banner/navi_border.gif" width="144" height="4"></td>');
						document.writeln('</tr>');
					}
					count++;
					}
				} 
		}
	}
}


//Added by masa
function list_all(performers, perLine,page) {
 var perLine=perLine;
 var page=page
 performers.list_all(perLine,page);
}
//end masa


Performers.prototype.list_all = function(perLine,page, popUrl, popName, popWidth, popHeight) {

        if(!popUrl) {
                var popUrl = "preview.html";
                var popName     = "exFreeView";
                var popWidth    = 760;
                var popHeight   = 600;
                var winconfig   = false;

                if(document.location.href.indexOf('/viewers/') != -1 ) {
                        popUrl = "preview.html";
                        popName = '';
                        winconfig = "left=0, Top=0, width=" + screen.width + ", height=" + screen.height + ", menubar=0, resizable=yes, toolbar=0, scrollbars=0, status=0";
                }
                var url = popUrl;
                var wname = popName;

                with(this) {
                        if(length) {
                                var count = 1;
                                var keys = new Array();
                                var i = 0;
                                for(var perf in performers) {
                                        keys[i++] = perf;
                                }
                                document.writeln('<tr>');


				var start=page*60;
				var end=start+60;
				if(end > keys.length) end=keys.length;
				if(keys.length < start) start=keys.length;
                                for(i=start; i < end; i++) { //END masa

                                // GO THROUGH ALL PERFORMERS
                                //for(i=0; i < keys.length; i++) {
                                        var linebreak = ((count%perLine) == 0);
                                        var k = keys[i];

                                        with(performers[k]) {
                                                if(popUrl.indexOf('?') == -1) url = popUrl + "?" + username;
                                                if(popName == '') wname = username;
                                                // USERNAME and AGE
                                                document.writeln('<td><table width="80" height="60" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td width="70" height="14" valign="bottom" class="girlslist">');
                                                document.writeln(username);
                                                document.writeln('</td><td width="10" height="14" valign="bottom" class="girlslist">');
                                                if(getAttValueByAttName('age_x') != '') {
                                                        document.writeln(getAttValueByAttName('age_x'));
                                                }

                                                // PROFILE
                                                document.writeln('</td></tr><tr align="center"><td colspan="2">');
                                                document.writeln('<a href="#" onClick="javascript:openPfProfile('+username + ')">');
                                                document.writeln('<img src="http://imageup.exshot.com' + getAttValueByAttName('live_thumbnail') + '" width="80" height=60" border="0" align="top"></a></td>');
                                                document.writeln('</td></tr><tr align="right"><td height="14" colspan="2">');
                                                document.writeln('<a href="#" onClick="javascript:openPfProfile('+username + ')">');
                                                document.writeln('<img src="images/icons/b_profile.gif" width="46" height="11" border="0">');
                                                document.writeln('</a></td></tr><tr><td height="7"></td></tr>');
						document.writeln('</table></td>');

                                        }
                                        if(linebreak) {
                                                document.writeln('</tr><tr>');
                                                //document.writeln('<td colspan="2" class="ss"> <img src="images/navi_banner/navi_border.gif" width="144" height="4"></td>');
                                                //document.writeln('</tr>');
                                        }
                                        count++;
                                        }
                                }
                }
        }
}

//Added by masa
function generate_link(num){
 var page=Math.ceil(num/60);
 var i=0;

 for(i=0; i<page; i++){
   document.writeln('<a href="girls_list.shtml?'+i+'">');
   document.writeln(i+1);
   document.writeln('</a>&nbsp;');
 }

}



Performers.prototype.list = function(perLine, popUrl, popName, popWidth, popHeight, noImg) { 
	
	if(!popUrl) {
		var popUrl = "preview.html";
		var popName	= "exFreeView";
		var popWidth	= 650;
		var popHeight	= 510;
		var winconfig	= false;

		if(document.location.href.indexOf('/viewers/') != -1 ) {
		//	popUrl = "preview.html";
			popName = '';
			winconfig = "left=0, Top=0, width=" + screen.width + ", height=" + screen.height + ", menubar=0, resizable=yes, toolbar=0, scrollbars=0, status=0"; 
		}
		var url = popUrl;
		var wname = popName;
		with(this) {
			if(length) {
				document.writeln('<tr>');
 
				var count = 1;
				var keys = new Array();
				var i = 0;
				for(var perf in performers) {
					keys[i++] = perf;
				} 
				keys.sort(randomizeOrder);
				
				// GO THROUGH ALL PERFORMERS
				for(i=0; i < keys.length; i++) {
					var linebreak = ((count%perLine) == 0);
					var k = keys[i];
					
					with(performers[k]) {
						if(popUrl.indexOf('?') == -1) url = popUrl + "?" + username;
						if(popName == '') wname = username;
						document.writeln('<td width=200>');
						document.writeln('<table width=100% height="126" border="0" cellpadding="0" cellspacing="0" background="images/online_girls/online_girls_bg_02.jpg">');
						document.writeln('<tr>');

						document.writeln('<td width="121" height="126" rowspan="2" align="center" nowrap background="images/online_girls/online_girls_bg_01.jpg">');
						document.writeln('<table width="108" height="126" border="0" align="center" cellpadding="0" cellspacing="0">');
						
						// USERNAME and AGE
						document.writeln('<tr>');
						document.writeln('<td width="89" height="18" valign="bottom">');
						document.writeln(username);
						document.writeln('</td>');
						if(getAttValueByAttName('age_x')) {
							document.writeln('<td width="34" height="18" align="right" valign="bottom" class="girlslist">');
							document.writeln(getAttValueByAttName('age_x'));
  					}
						document.writeln('</tr>');
						
						// IMAGE
						document.writeln('<tr align="center">');
						document.writeln('<td height="81" colspan="2" valign="middle">');
						document.writeln('<div align="center">');
						document.writeln('<a href="#" onClick="javascript:openThumbnailWindow('+ username +')">');
						document.writeln('<img src="http://imageup.exshot.com' + getAttValueByAttName('live_thumbnail') + '" width="108" height=81 class="girlBox"></a>');
						document.writeln('</div></td>');
						document.writeln('</tr>');

						// LINK TO TEXT CHAT
						document.writeln('<tr align="right" valign="top">');
						document.writeln('<td colspan="2" align="left">');
						document.writeln('<a href="#" onClick="javascript:openLaunchViewer('+ username +')">');
						document.writeln('<img src="images/icons/b_freeview.gif" width="69" height="11" border="0"></a>');
						if(busy_performers.getPerformer(username))
						  document.writeln('<img src="images/icons/in_session.gif" width=30 height=11 border=0></a>');
						document.writeln('</td></tr></table></td>');

						// PROFILES 
						document.writeln('<td height="108" valign="top" background="images/online_girls/online_girls_bg_02.jpg" class="ss"><br>');
						
						// LANGUAGE FLAGS 
						if(this.lang) {
							var vl = getAttValueByAttName('lang_x');
							var vc = 0;
							for(vid in vl.val_ids) {
								if(flag_files[vl.val_ids[vid]-1]) {
									vc += 1;
									if(vc < 4)
										document.write("<img src='images/icons/" + flag_files[vl.val_ids[vid]-1]+"'width=13 height=9 align=right>");
								}
							}
						}

						// MIC, CAMERA, TOY
						if(this.icons) {
							if(this.lang) document.write("<br>");
							var cam = (getAttValueByAttName('has_hires') == 'はい');
							var mic = (getAttValueByAttName('has_mic') == 'はい');
							var toy = (getAttValueByAttName('has_toy') == 'はい');

	/*					if(this.icons) {
							if(this.lang) document.write("<br>");
							var cam = (getAttValueByAttName('has_hires') == 'Yes');
							var mic = (getAttValueByAttName('has_mic') == 'Yes');
							var toy = (getAttValueByAttName('has_toy') == 'Yes');
    	*/
							if(cam) 
								document.write('<img src="images/icons/Aicon_hicamera.gif" width="13" height="13" align="absmiddle">');	
							if(mic) 
								document.write('<img src="images/icons/Aicon_mike.gif" width="13" height="13" align="absmiddle">');
							if(toy) document.write('<img src="images/icons/Aicon_adulttoy.gif" width="13" height="13" align="absmiddle">'); document.write('<br>'); 
						}
 
						// HORNY LEVEL - CHANGE TO SWITCH STATEMENT OR FOR LOOP
						var vl = getAttValueByAttName('horny_level');
						
						if(vl != '') {
							document.write("<img src='images/icons/H_level_" + vl.val_ids + "'.gif width=49 height=10 border=0><br>");
						}

						// BUST-WAIST-HIP
						document.writeln(getAttValueByAttName('breast_size'));
						if(getAttValueByAttName('breast_cup') != '') {
							document.writeln('(');
							document.writeln(getAttValueByAttName('breast_cup'));
							document.writeln(')');
						}
						if(getAttValueByAttName('waist_x') != '') {
							document.writeln(getAttValueByAttName('waist_x'));
						}
						if(getAttValueByAttName('hip_x') != '') {
							document.writeln('-');
							document.writeln(getAttValueByAttName('hip_x'));
						}
						document.writeln('<br>');

						// WHAT CAN I DO FOR YOU
						var vl = getAttValueByAttName('do_for_you');
						for(var v_id in vl.val_ids){
							if(do_for_you_files[vl.val_ids[v_id]-1]) {
								document.write("<img src='images/icons/" + do_for_you_files[vl.val_ids[v_id]-1]+"'width=13 height=13 align=absmiddle>");
							}
						}
						document.write("<br>");

						// MESSAGE
						var msg = getAttValueByAttName('more_message');
						var sub_msg = (msg.values[0]).substring(0,18);
						if(msg != "") { 
							sub_msg += '...';
						}
						document.writeln(sub_msg);
						document.writeln('</td>');
						
						// PROFILE LINK
						document.writeln('<td width="4" height="126" rowspan="2" valign="top" background="images/online_girls/online_girls_bg_03.jpg" class="ss">&nbsp;</td>');
						document.writeln('</tr><tr>');
						document.writeln('<td height="18" align="right" valign="top" class="ss">');
						document.writeln('<a href="#" onClick="javascript:openPfProfile('+ username +')">');
						document.writeln('<img src="images/icons/b_profile.gif" width="46" height="11">');
						document.writeln('</a></td></tr>');
						document.writeln('</table></td>');
					}
					if(linebreak) document.writeln('<tr>');
					count++;

				}
			} else {
				if(noImg) {
					document.writeln('<tr><td valign=top><img src="images/icons/'+ noImg + '"></td></tr>');
				} else {
					document.writeln('<tr><td valign=top><img src="images/icons/no_online_girls.jpg"></td></tr>');
				}
			}
		}

		 
	}


}
var flag_files = new Array('flag_jp.gif','flag_eng.gif', 'flag_korea.gif', 'flag_china.gif');
var do_for_you_files = new Array('Aicon_uncensored.gif', 'Aicon_masturbate.gif', 'Aicon_anal.gif', 'Aicon_vibe.gif');


function list_performer (performer) {
 performer.print();
}

Performer.prototype.print=function() {
 var online=0;
 with (this) {
  if (online_performers.getPerformer(username)) online=1;
  if (online) document.write('<A href="javascript:openThumbnailWindow(performer)">');
  document.write('<IMG width="160" height="120" src="http://imageup.exshot.com'+getAttValueByAttName('snapshot')+'" alt="Snapshot - '+username+'" border="5"><BR><b>'+username);

  if (online) document.write('</A>');

  if(this.lang) {
        document.write('<br>');
        var vl = getAttValueByAttName('language');
        var vc = 0;
        for(vid in vl.val_ids) {
                if(flag_files[vl.val_ids[vid]-1]) {
                        vc += 1;
                        document.write("<img src='/images/icons/"+ flag_files[vl.val_ids[vid]-1]+"' width=20 height=12 alt='"+vl.values[vid]+"'>&nbsp;");
                        if (vc%4 == 0) document.write("<BR>");
        }}
  }



  if (online) document.write('<br><A href="#" onClick="openThumbnailWindow(performer)"><img src="images/icons/online.gif" border="0" vspace="5"></A>');
	}  }


function list_category (categories, id) {
 var category=categories.get(id);
 if (category==null) return null;
 with (category) {
	list_performers(performers);
 }
}

function list_performers (performers) {
	if(performers.performers)
		performers = performers.performers;
  for (var performer in performers) {
   with (performers[performer]) {
    document.writeln('<TR>');
    document.write('<TD><A href="/profile.html?'+username+'">'); writeImageAttribute('live_thumbnail', 80, 60, 'Live Thumbnail - '+username); document.write('</A></TD>');
    document.write('<TD><A href="/profile.html?'+username+'">'); document.write(username); document.write('</A></TD>');
    document.write('<TD>'); document.write(getAttValueByAttName('age')); document.write('</TD>');
    document.write('<TD>'); document.write(getAttValueByAttName('area')); document.write('</TD>'); 
	 } 
  }
 } 


function setBan(pname) {
   var t = new Date();
   var d = new Date();
   t.setTime(d.getTime() + 1000*60*60);
   var strCookie = "";
   strCookie = escape(pname+"_ban") + "=on;"
   strCookie += "expires=" + t.toGMTString();
   document.cookie = strCookie;

}
function checkBan(pname) { return (document.cookie.indexOf(escape(pname+"_ban")+"=") != -1); }

function setTextBan(pname) {
   var t = new Date();
   var d = new Date();
   t.setTime(d.getTime() + 1000*60*60);
   var strCookie = "";
   strCookie = escape(pname+"_textBan") + "=on;"
   strCookie += "expires=" + t.toGMTString();
   document.cookie = strCookie;
}
function checkTextBan(pname) { return (document.cookie.indexOf(escape(pname+"_textBan")+"=") != -1); }

function setTextKick(pname) { 
   var t = new Date();
   var d = new Date();
   t.setTime(d.getTime() + 1000*60*60);
   var strCookie = "";
   strCookie = escape(pname+"_textKick") + "=on;"
   strCookie += "expires=" + t.toGMTString();
   document.cookie = strCookie;
}
function checkTextKick(pname) { return (document.cookie.indexOf(escape(pname+"_textKick")+"=") != -1); }



function setViewerMode(mode) {
	document.cookie = "vm=" + mode + ";";
}

function checkViewerMode() { 

        if( document.cookie.indexOf(escape("vm")) != -1 ) {
                index = document.cookie.indexOf("vm");
                cookieStart = (document.cookie.indexOf("=", index) + 1);
                cookieEnd       = document.cookie.indexOf(";", index);
                        if (cookieEnd == -1) {
                                cookieEnd = document.cookie.length;
                        }
                vmode   = document.cookie.substring(cookieStart, cookieEnd);
		/*var vmode_str = "Chat Mode";
                if (vmode == 'public') {
                        vmode_str = 'Chat Mode';
                } else if (vmode == 'ROM') {
                        vmode_str = 'Peep Mode';
                }*/
                return vmode;

        } else {
		return "public";
        }
}

function closeWindow() {
        window.top.close();
}

function openAddPoints() {

	if(get_user().user_type == 207) {
        //var auth_cookie = chk_auth();
        //var auth_arr = auth_cookie.split("-");

        //if(auth_arr[2] == 207) {
     //window.open('/promo_join.shtml','join');
     window.open('/addpoint2.shtml','addpoint');
  }
  if(get_user().user_type == 205) {
    window.open('/addpoint.shtml','addpoint');
  } 
}

function logged_in(user_name, password, user_type, performer_name, chat_type) {
   var t = new Date();
   var d = new Date();
   t.setTime(d.getTime() + 1000*60*60*24*365); // one year
   var exp = "expires=" + t.toGMTString();

//alert(user_name + "-" + password + "-"+user_type+"_"+performer_name+"_"+chat_type);

        document.cookie = "un="+user_name+";expires="+exp+";path=/";
        document.cookie = "pw="+password+";path=/";
        document.cookie = "ut="+user_type+";expires="+exp+";path=/";

//alert(document.cookie);

//alert(performer_name);
//        if(performer_name) {
//		setRecentList(performer_name);
 // 	}
//        setViewerMode(chat_type);


}

function writeTextChat (document, configuration) {
 var login = "";

 if(configuration.VName != '') {
	login = "&user_arg="+configuration.VName+"&pass_arg="+configuration.VPass;
 }
 document.writeln('<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="760" height="300" id="video_chat" align="">');
 document.writeln('<PARAM name="movie" value="/flash/text_chat.swf?performerMode_arg=210&ip_arg='+configuration.Ip+'&server_arg='+configuration.Server+'&langId_arg='+configuration.Language+login+'">')
 document.writeln('<PARAM name="loop" value="false">');
 document.writeln('<PARAM name="menu" value="false">');
 document.writeln('<PARAM name="quality" value="high">');
 document.writeln('<PARAM name="bgcolor" value="#000000">');
 document.writeln('<EMBED src="/flash/text_chat.swf?performerMode_arg=210&ip_arg='+configuration.Ip+'&server_arg='+configuration.Server+'&langId_arg='+configuration.Language+login+'" quality="high" bgcolor="#000000" width="760" height="300" name="text_chat" align="" type="application/x-shockwave-flash" pluginspace="http://www.macromedia.com/go/getflashplayer"></EMBED>');
 document.writeln('</OBJECT>'); 
}

function get_new_performers(num) {

	var temp_date_time='';
	with(performers) {
		var i=1;
		for (var performer in performers) {
			if(i <= num) {
				if(temp_date_time != '') {
					var reg_date_time = (performers[performer].reg_date).getTime();
					if(reg_date_time >= temp_date_time) {
						new_performers.add(performers[performer]);
					}
				} else {
						new_performers.add(performers[performer]);
				}
			}
			temp_date_time =(performers[performer].reg_date).getTime();
			i++;
		}
	}
}

qSearchAge=function(select) {
  if(select.selectedIndex != 0) {
    document.forms["qSearch"].age1.value= 2 + (parseInt(select.selectedIndex -1) * 3);
    document.forms["qSearch"].age2.value= 3 + (parseInt(select.selectedIndex -1) * 3);
    document.forms["qSearch"].age3.value= 4 + (parseInt(select.selectedIndex -1) * 3);
    //alert(document.forms["qSearch"].age1.value+" "+document.forms["qSearch"].age2.value+" "+document.forms["qSearch"].age3.value);
  }
}

function writeGoodsFormInput(points) {
   var user = get_user();
   document.write('<input type=hidden size="4" value="');
   if(user.site_id == 1001343) {
     if(points == 10) {
			if(user.user_type == 207) { document.write("1019373"); }
			else { document.write("1006121"); }
     }
     if(points == 30) {
			if(user.user_type == 207) { document.write("1019383"); }
			else { document.write("1006201"); }
     }
     if(points == 40) {
			if(user.user_type == 207) { document.write("1019393"); }
			else { document.write("1006241"); }
     }
     if(points == 60) {
			if(user.user_type == 207) { document.write("1019403"); }
			else {		document.write("1006261"); }
     }
     if(points == 95) {
			if(user.user_type == 207) { document.write("1019413"); }
			else {		document.write("1006321"); }
     }
     if(points == 145) {
			if(user.user_type == 207) { document.write("1019423"); }
			else {		document.write("1006361"); }
     }
   }
   document.write('" name="goods_id">');
}

