// EXtended Vars
if(typeof(ownserver) == "undefined") {
  ownserver = "http://tokyo2shot.tv/";
}

function openAppWindow(url, name, width, height, wincfg) {
        if(!wincfg) wincfg = 'resizable=yes, toolbar=0, scrollbars=1, personalbar=no, menubar=0, width='+width+', height='+height;
        var w = window.open(url,name,wincfg);
        w.focus();
}


Performers.prototype.list= function(perLine, popUrl, popName, popWidth, popHeight, howMany, keepOrder, imgType, type ) {
	if(!popUrl) {
		var popUrl = "launch_free.html";
		var popName = 'FreeView';
		var popWidth = 755;
		var popHeight = 554;
		if(document.location.href.indexOf('/viewers/') != -1 || document.location.href.indexOf('/video_chat/') != -1 ) {
			popUrl = "vc_frameset.shtml";
			popName = '';
			winconfig = "left=0, Top=0, width=" + screen.width + ", height=" + screen.height + ", menubar=0, resizable=yes, toolbar=0, scrollbars=1, status=0";
		}
	}

	if( (typeof(imgType) == "undefined") || (imgType == "") ) {
		imgType = "live_thumbnail";
	}

	var thumbwid = 80;
	var thumbheig= 60;

	if(imgType == "vctp_thumbnail") {
		thumbwid = 120;
		thumbheig= 90;
	}

	if(imgType == "snapshot") {
		thumbwid = 160;
		thumbheig= 120;
	}

	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) {
				if(type == "NEW"){
					with(performers[perf]){
						if(getAtt('new') == '1') keys[i++] = perf;
					}
				}
				else if(type == "HQ"){
					with(performers[perf]){
						if( getAtt('has_hires') == '1' && getAtt('has_mic') == '1')keys[i++] = perf;
					}
				}
				else if(type == "REC"){
					with(performers[perf]){
						if( getAtt('recommended') == '1')keys[i++] = perf;
					}
				}
				else
					keys[i++] = perf;
			}
			
	if(!keepOrder) keys.sort(randomizeOrder);
	for(i = 0; i < keys.length; i++) {
		if(howMany && i >= howMany) break;
		var linebreak=((count%perLine)==0);
		var k = keys[i];
		with (performers[k]) {
		if(popUrl.indexOf('?') == -1) url = popUrl + "?"+username;
		if(popName == '') wname = username;

//START GIRL BOX
	document.writeln('<div id="girlBoxMain">');
		document.write('<div align="center"><div id="girlBoxSession">');
			if(public_performers.getPerformer(username))document.write('<img src="http://tokyo2shot.tv/images/picon1.gif" alt="チャット中" />');
			else if(private_performers.getPerformer(username))	document.write('<img src="http://tokyo2shot.tv/images/picon2.gif" alt="２ショット中" />');
			else if(!public_performers.getPerformer(username) && !private_performers.getPerformer(username))document.write('<img src="http://tokyo2shot.tv/images/picon3.gif" alt="待機中" />');
		document.write('</div></div>');
	
		document.write('<div align="center"><div id="girlBoxPic">');
			document.write('<a href="#" onclick="openAppWindow(\''+url+'\',\''+wname+'\','+popWidth+','+popHeight+')">');
			document.write('<img src="http://aff-images.dxlive.com'+getAttValueByAttName(''+imgType+'')+'" alt="Live Thumbnail - '+username+'" border="0" width="'+thumbwid+'" height="'+thumbheig+'"></a>');
		document.write('</div></div>');
		
		document.writeln('<div id="girlBoxName">');
			document.writeln('<a href="#" onclick="openAppWindow(\''+url+'\',\''+wname+'\','+popWidth+','+popHeight+')">'+username+'</a>');
			document.writeln('<div align="center">'+viewers+'人とチャット中</div>');
		document.writeln('</div>');
		
		document.writeln('<div id="girlBoxIcons">');
			var toy = getAttributeValueId(537);
			var cam = (getAtt('has_hires') == '1');
			var rec = ((getAtt('recommended') == '1') || (getAtt('recommended') == '2') || (getAtt('recommended') == '3'));
			var mic = (getAtt('has_mic') == '1');
			var flower = (getAtt('new') == '1');
			
			if(toy==1) document.write('<img src="http://aff-jp.dxlive.com/VCTP/images/icons/icon_toy_shake.gif" />');
			if(toy==2) document.write('<img src="http://aff-jp.dxlive.com/VCTP/images/icons/icon_toy_blink.gif" />');
			if(flower) document.writeln('<img src="http://tokyo2shot.tv/images/icon_newgirl.gif" alt="新人" />');
			if(cam) document.writeln('<img src="http://tokyo2shot.tv/images/icon_HD.gif" alt="高画質" />');
			if(mic) document.writeln('<img src="http://tokyo2shot.tv/images/icon_sound.gif" alt="マイク" />');
			if(rec)	document.writeln('<img src="http://tokyo2shot.tv/images/icon_flower.gif" alt="お薦め" />');
		document.writeln('</div>');
	document.writeln('</div>');
//END GIRL BOX

		}
		count++;
		}
	} else {
		document.writeln('<div><img src="http://tokyo2shot.tv/images/no_performers.gif" alt="no performer" /></div>');
	}
}
}

var flag_files = new Array('flag-jp.gif','flag-en.gif','flag-kr.gif','flag-ch','flag-ch','flag-fr','flag-sp','flag-it');

// NEW PRINT

function vclist_performer (performer) {
 performer.vcprint();
}

Performer.prototype.vcprint=function() {
 var online=0;
 with (this) {

  if (online_performers.getPerformer(username)) online=1;
  if (online) {
   document.writeln('<TR><TD class="performer_online" align="center">'); }
  else {
   document.writeln('<TR><TD class="performer_offline" align="center">'); }

  if (online) document.write('<TR><TD class="performer_online" align="center"><A href="javascript:;" onClick="openViewersChat(performer)"><img src="' + ownserver + '/images/button/now_online.gif" border="0" vspace="5"><br><img src="http://tokyo2shot.tv/images/button/go_chat.gif" border="0"></A>');
        document.write('</TD></TR>'); }  }


// search list * Target blank

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.shtml?'+username+'" target="_blank">'); writeImageAttribute('live_thumbnail', 80, 60, 'Live Thumbnail - '+username); document.write('</A></TD>');
    document.write('<TD><A href="/profile.shtml?'+username+'" target="_blank">'); 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>');
    document.write('<TD>'); document.write(getAttValueByAttName('category')); document.write('</TD>');
    document.write('<TD>'); document.write(getAttValueByAttName('language')); document.write('</TD>');
    document.write('<TD>'); document.write(getAttValueByAttName('job')); document.write('</TD>');

         }
  }
 }
