var validCTPOpener = true;
var rootDomain = 'http://www.ctprofiles.net/';
function validOpener() { return true; }

function openProfile(id) {
	window.open(rootDomain+id,'p'+id,'width=626,height=672,status=yes,resizable=no,scrollbars=no');
}

function characterWindow(charData, currentPage, profileId, level, race, clas) {
	if ( typeof(currentPage) == "undefined" )
		currentPage = -1;
	if ( typeof(profileId) == "undefined" )
		profileId = 0;

	var raceMap = Array(10, 11, 3, 7, 1, 4, 2, 6, 8, 5);
	var classMap = Array(11, 3, 8, 2, 5, 4, 7, 9, 1);

	var icon = (level==70?"70":(level>=60?"60":"1")) + "/" + (charData[2]==0?'0-':'1-') + raceMap[race] + "-" + classMap[clas] + ".gif";

	document.write('\
								 \
<div class="ct_header">Character: '+charData[1]+'</div>\
<div id="ct_news_post">\
\
	<table cellpadding=0 cellspacing=3>\
		<tr>\
			<td rowspan=4 align="center" valign="top" style="padding-right:5px;">\
			\
				<table cellspacing = "0" cellpadding = "0" border = "0" style="cursor:pointer; margin-top:8px;" \
				title="Click to Edit Character" onClick="window.location=\'/characters.ct?a=edit&cid='+charData[0]+'\'">\
					<tr>\
						<td colspan = "3"><img src = "images/wow/portrait-top.gif" width = "82" height = "8"></td>\
					</tr>\
					<tr>\
						<td><img src = "images/wow/portrait-left.gif" width = "8" height = "64"></td>\
						<td background = "images/portraits/'+icon+'"><table cellspacing = "0" cellpadding = "0" border = "0">\
									</tr>\
									<tr>\
										<td background = "images/wow/level-circle.gif"><div style = "height:64px; width:64px;"><div style = "position: relative; top:53px; margin-left: 52px; text-align:center; color: #FFD823;"><b><small>'+charData[7]+'</small></b></div></div></td>\
									</tr>\
								</table></td>\
							<td><img src="images/wow/portrait-right.gif" Border="0" width = "10" height = "64"></td>\
						</tr>\
						<tr><td colspan = "3"><img src = "images/wow/portrait-bot.gif" width = "82" height = "11"></td></tr>\
					</table>\
				</td>\
				<td colspan=2>\
					<b style="font-size:14px;">'+charData[4]+'</b><small><br> Level '+charData[5]+'<br/>'+charData[6]+'</small>\
				</td>\
			</tr>\
			<tr>\
				<td nowrap>Link to View Main Profile: </td>\
				<td width="100%">\
					<div style="border: 1px #999999 solid; background-color:#EFF0F2; padding:1px;width:200px;">\
						<a href="'+charData[8]+'" onClick="openProfile('+charData[8]+'); return false" class="ct_link">\
							http://ctprofiles.net/'+charData[8]+'\
						</a>\
					</div>\
				</td>\
			</tr>\
			'+(profileId>0&&profileId!=charData[8]?'<tr>\
				<td nowrap>Link to View This Profile: </td>\
				<td width="100%">\
					<div style="border: 1px #999999 solid; background-color:#EFF0F2; padding:1px;width:200px;">\
						<a href="'+profileId+'" onClick="openProfile('+profileId+'); return false" class="ct_link">\
							http://ctprofiles.net/'+profileId+'\
						</a>\
					</div>\
				</td>\
			</tr>':'') + '\
		</table>\
	<hr>\
\
	<a href="/profiles.ct?cid='+charData[0]+'"><img src="images/interface/edit_profiles' + (currentPage==0?'_highlight':'') + '.gif" width=120 height=38 border=0/></a>\
	\
	<a href="/characters.ct?a=edit&cid='+charData[0]+'"><img src="images/interface/edit_stats' + (currentPage==1?'_highlight':'') + '.gif" width=120 height=38 border=0/></a>\
	\
	<a href="/reputation.ct?cid='+charData[0]+'"><img src="images/interface/edit_rep' + (currentPage==2?'_highlight':'') + '.gif" width=120 height=38 border=0/></a>\
	\
	<a href="/skills.ct?cid='+charData[0]+'"><img src="images/interface/edit_skills' + (currentPage==3?'_highlight':'') + '.gif" width=120 height=38 border=0/></a>\
	\
	<a href="/talents.ct?cid='+charData[0]+'"><img src="images/interface/edit_talents' + (currentPage==4?'_highlight':'') + '.gif" width=120 height=38 border=0/></a>\
\
</div>');

}

