function show(id)
{
	var msg = document.getElementById(id);
	if (msg)
	{
  	if(msg.style.display == "none")
  	{
  		msg.style.display = "";
  	} else {
  		msg.style.display = "none";
  	}
	}
}

function readCookie(name)
{
	var cookieValue = "";
	var search = name + "=";
	if(document.cookie.length > 0)
	{ 
		offset = document.cookie.indexOf(search);
		if (offset != -1)
		{ 
			offset += search.length;
			end = document.cookie.indexOf(";", offset);
			if (end == -1) end = document.cookie.length;
			cookieValue = unescape(document.cookie.substring(offset, end))
		}
	}
return cookieValue;
}

function createCookie(name,value,days) {
	if (days) {
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
}

function openWindow(url,popW,popH)
{
	w = window.screen.width;
	h = window.screen.height;

	popW = popW +6;
	popH = popH+45;

	var leftPos = (w-popW)/2;
	var topPos = (h-popH)/2;
	var options = 'width=' + popW + ',height=' + popH + ',top=' + topPos + ',left='+leftPos + ',resizable=1, status=0, titlebar=0';

	var regExStr = /add_to_favorites/i;
	if (regExStr.test (url)) {
		var k = window.open(url,'add_to_favorites',options);
	} else {
		var k = window.open(url,'new_win',options);
	}
	k.resizeTo(popW,popH);
	return k;
}


function openWindowScroll(url,popW,popH)
{
	w = window.screen.width;
	h = window.screen.height;

	popW = popW +6;
	popH = popH+45;

	var leftPos = (w-popW)/2;
	var topPos = (h-popH)/2;
	var options = 'width=' + popW + ',height=' + popH + ',top=' + topPos + ',left='+leftPos + ',resizable=1, status=0, titlebar=0 ,scrollbars=1';

	var regExStr = /add_to_favorites/i;
	if (regExStr.test (url)) {
		var k = window.open(url,'add_to_favorites',options);
	} else {
		var k = window.open(url,'new_win',options);
	}
	k.resizeTo(popW,popH);
	return k;
}


function disableEl2 (formEl, el) {
	col="InactiveCaptionText";
	col="#E4E4E4";
	if (el.value == 0 || el.value == "" || (el.id == "stte" && el.options[0].selected == true)) {
		clearForm(formEl);
	} else 
	if(el.id=='zipp') {
		document.getElementById('cty').disabled=true; document.getElementById('cty').style.background = col;
		document.getElementById('stte').disabled=true; document.getElementById('stte').style.background = col;
		document.getElementById('dist').disabled=false; document.getElementById('dist').style.background = '#FFFFFF';
	} else	
	if(el.id=='cty') {
		document.getElementById('zipp').disabled=true; document.getElementById('zipp').style.background = col;
		document.getElementById('dist').disabled=true; document.getElementById('dist').style.background = col;
	} else	
	if(el.id=='stte') {
		document.getElementById('zipp').disabled=true; document.getElementById('zipp').style.background = col;
		document.getElementById('dist').disabled=true; document.getElementById('dist').style.background = col;
	} else	
	if(el.id=='dist') {
		document.getElementById('cty').disabled=true; document.getElementById('cty').style.background = col;
		document.getElementById('stte').disabled=true; document.getElementById('stte').style.background = col;
	} 
}

function clearForm (formEl) {
	var excludeRegStr = /ex|submit|reset|hidden/i;
	for (var i = 0; i < formEl.length; i++) {
		if (!excludeRegStr.test (formEl.elements[i].id)) {
			if (formEl.elements[i].id == 'dist') {
				formEl.elements[i].disabled = true;
				formEl.elements[i].style.background = "#E4E4E4";
			}
			else {
				formEl.elements[i].disabled = false;
				formEl.elements[i].style.background = "#FFFFFF";
			}
		}
	}
}

// ============
var win2;
function modal2() {
}
modal2.open = function(type) {
	win2 = document.getElementById(type);
	win2.className = "modalShow";
	win2.style.left = ((browser() ? (document.documentElement.clientWidth ? document.documentElement.clientWidth : document.body.clientWidth) : document.body.clientWidth)/2)-(win3.offsetWidth/2)+(browser() ? document.documentElement.scrollLeft : document.body.scrollLeft);
	win2.style.top = ((browser() ? (document.documentElement.clientHeight ? document.documentElement.clientHeight : document.body.clientWidth) : document.body.clientHeight)/2)-(win3.offsetHeight/2)+(browser() ? document.documentElement.scrollTop : document.body.scrollTop);
	win2.style.zIndex = 92;
}
modal2.close = function(type) {
	win2.className = 'modal';
}
// =====
// ============
var win3,win4,win4;
function myAlert() {
}
myAlert.open = function(txt, action, action2, compact) {
	win3 = document.getElementById('questionDiv');
	win3.style.display = "";
	win4 = document.getElementById('questionMsg');
	win4.innerHTML=txt;
	win6 = document.getElementById('questionTd');
	
	if (compact) {
		win6.style.textAlign = 'left';
		win4.style.fontWeight = 'normal';
		win4.style.fontSize = '12px';
	}
	else {
		win6.style.textAlign = '';
		win4.style.fontWeight = '';
		win4.style.fontSize = '';
	}
	
	win3.style.left = (document.body.clientWidth/2)-(win3.offsetWidth/2)+(document.body.scrollLeft);
	win3.style.top = ((browser() ? (document.documentElement.clientHeight ? document.documentElement.clientHeight : document.body.clientWidth) : document.body.clientHeight)/2)-(win3.offsetHeight/2)+(browser() ? document.documentElement.scrollTop : document.body.scrollTop);
	win3.style.zIndex = 92;

	win4 = document.getElementById('question_buttons1');
	win5 = document.getElementById('question_buttons2');
	if(typeof action == 'undefined' || action=='') {
		win4.style.display='';
		win5.style.display='none';
		win5 = document.getElementById('questionAct2');
	} else {
		win4.style.display='none';
		win5.style.display='';
		win5 = document.getElementById('questionAct');
		
		win5.onclick = function () { 
						eval(action);
                   }
		win5 = document.getElementById('questionAct3');
	}
	if(typeof action2 == 'undefined' || action2==''){
		win5.onclick = function () {
                  		myAlert.close();
                   }
	} else {
		win5.onclick = function () {
                  		eval(action2);
                   }
	}
	
}
myAlert.close = function() {
	win3.style.display = 'none';
}


// =====

function myAlert1() {
}
myAlert1.open = function(txt, action, action2, compact) {
	win3 = document.getElementById('questionDiv1');
	win3.style.display = "";
	win4 = document.getElementById('questionMsg1');
	win4.innerHTML=txt;
	win6 = document.getElementById('_questionTd');
	
	if (compact) {	
		win6.style.textAlign = 'left';
		win4.style.fontWeight = 'normal';
		win4.style.fontSize = '12px';
	}
	else {
		win6.style.textAlign = '';
		win4.style.fontWeight = '';
		win4.style.fontSize = '';
	}

	win3.style.left = ((browser() ? (document.documentElement.clientWidth ? document.documentElement.clientWidth : document.body.clientWidth) : document.body.clientWidth)/2)-(win3.offsetWidth/2)+(browser() ? document.documentElement.scrollLeft : document.body.scrollLeft);
	win3.style.top = ((browser() ? (document.documentElement.clientHeight ? document.documentElement.clientHeight : document.body.clientWidth) : document.body.clientHeight)/2)-(win3.offsetHeight/2)+(browser() ? document.documentElement.scrollTop : document.body.scrollTop);

	win3.style.zIndex = 92;
	win4 = document.getElementById('_question_buttons1');
	win5 = document.getElementById('_question_buttons2');
	if(typeof action == 'undefined' || action=='') {
		win4.style.display='';
		win5.style.display='none';
		win5 = document.getElementById('_questionAct2');
	} else {
		win4.style.display='none';
		win5.style.display='';
		win5 = document.getElementById('_questionAct');
		win5.onclick = function () {
						eval(action);
                   }
		win5 = document.getElementById('_questionAct3');
	}
	if(typeof action2 == 'undefined' || action2==''){
		win5.onclick = function () {
                  		myAlert1.close();
                   }
	} else {
		win5.onclick = function () {
                  		eval(action2);
                   }
	}
	
}
myAlert1.close = function() {
	win3.style.display = 'none';
}

// =====

function myAlert2() {}
myAlert2.open = function() {
	if ($.browser.msie)
		setTimeout('jQuery.smoothbox({ guestCallNow: true })', 200);
	else
		jQuery.smoothbox({ guestCallNow: true });
}


function myAlert3() {
}
myAlert3.linkTo = "";
myAlert3.open = function(linkVal, t_st, cc_st) {
	myAlert3.linkTo = linkVal;
	if(Get_Cookie('joinusStarted')){
		window.location = 'joinus.php';
		return;
	}
	
	win3 = document.getElementById('questionDiv3');
	win3.style.display = "";
	
	document.getElementById('t_st').innerHTML = t_st;
	document.getElementById('cc_st').innerHTML = cc_st;
	
	win3.style.left = ((browser() ? (document.documentElement.clientWidth ? document.documentElement.clientWidth : document.body.clientWidth) : document.body.clientWidth)/2)-(win3.offsetWidth/2)+(browser() ? document.documentElement.scrollLeft : document.body.scrollLeft);
	win3.style.top = ((browser() ? (document.documentElement.clientHeight ? document.documentElement.clientHeight : document.body.clientWidth) : document.body.clientHeight)/2)-(win3.offsetHeight/2)+(browser() ? document.documentElement.scrollTop : document.body.scrollTop);
	win3.style.zIndex = 92;
}
myAlert3.close = function() {
	win3.style.display = 'none';
}

myAlert3.yes = function() {
	win3.style.display = 'none';
	window.location = myAlert3.linkTo;
}

//=====

function myAlert4() {
}
myAlert4.open = function() {
	win3 = document.getElementById('questionDiv4');
	win3.style.display = "";
	
	win3.style.left = ((browser() ? (document.documentElement.clientWidth ? document.documentElement.clientWidth : document.body.clientWidth) : document.body.clientWidth)/2)-(win3.offsetWidth/2)+(browser() ? document.documentElement.scrollLeft : document.body.scrollLeft);
	win3.style.top = ((browser() ? (document.documentElement.clientHeight ? document.documentElement.clientHeight : document.body.clientWidth) : document.body.clientHeight)/2)-(win3.offsetHeight/2)+(browser() ? document.documentElement.scrollTop : document.body.scrollTop);
	win3.style.zIndex = 92;
}
myAlert4.close = function() {
	win3.style.display = 'none';
}


// =====

var objBody;
var objOverlay;
var win;
var msgName;
var msgFrom;
var request;

function modal()
{
	objBody                 = document.getElementsByTagName("body").item(0);
	objOverlay              = document.createElement("div");
	objOverlay.style.height = objBody.offsetHeight + "px";
}

modal.open = function(type)
{
	if(!objOverlay) {
		objOverlay = document.createElement("div");
	}
	objOverlay.style.display = 'block';
	
	win = document.getElementById(type);

	if(type!='msgModal' && type!='inv') {
		type = 'msgModal';
	}

	switch(type)
	{
		case "msgModal":

			msgFrom = document.getElementById(type+"Form");
			document.getElementById('msgForm').reset();

			var testJavaScript = document.getElementById("testJavaScript");
			testJavaScript.setAttribute('value','test_OK');
			testJavaScript.value = 'test_OK2';

			var prof = document.getElementById("prof_id");
			prof.setAttribute('value',pr_id);
			prof.value = pr_id;

			win.className = "modalShow";
			win.style.left = ((browser() ? (document.documentElement.clientWidth ? document.documentElement.clientWidth : document.body.clientWidth) : document.body.clientWidth)/2)-(win3.offsetWidth/2)+(browser() ? document.documentElement.scrollLeft : document.body.scrollLeft);
			win.style.top = ((browser() ? (document.documentElement.clientHeight ? document.documentElement.clientHeight : document.body.clientWidth) : document.body.clientHeight)/2)-(win3.offsetHeight/2)+(browser() ? document.documentElement.scrollTop : document.body.scrollTop);
			win.style.zIndex = 92;

		break;
		case "inv":

			var prof = document.getElementById("profile_id");
			prof.setAttribute('value',pr_id);
			prof.value = pr_id;

			win.className = "modalShow";
			win.style.left = ((browser() ? (document.documentElement.clientWidth ? document.documentElement.clientWidth : document.body.clientWidth) : document.body.clientWidth)/2)-(win3.offsetWidth/2)+(browser() ? document.documentElement.scrollLeft : document.body.scrollLeft);
			win.style.top = ((browser() ? (document.documentElement.clientHeight ? document.documentElement.clientHeight : document.body.clientWidth) : document.body.clientHeight)/2)-(win3.offsetHeight/2)+(browser() ? document.documentElement.scrollTop : document.body.scrollTop);
			win.style.zIndex = 92;
		break;
	}
}

modal.close = function(type)
{
	objOverlay.style.display = 'none';
	win.className = 'modal';
    document.getElementById('portfolio_message_err').style.display    = 'none';
    document.getElementById('portfolio_message_err').style.visibility = 'hidden';
    document.getElementById('portfolio_message_err').innerHTML        = '';
    document.getElementById('community').defaultValue                 = '';
    document.getElementById('community').value                        = '';
}

function addFav(favId, favProfileId,favType)
{
	var mForm = document.getElementById("formFav");
	var vfavId = document.getElementById("favId");
	var vfavType = document.getElementById("favType");
	var vfavProfileId = document.getElementById("favProfileId");
	var vfavAct = document.getElementById("favAct");

	vfavId.value = favId;
	vfavType.value = favType;
	vfavAct.value='addFav';

	mForm.submit();
}

function remFav(favId, favProfileId,favType)
{
	var mForm = document.getElementById("formFav");
	var vfavId = document.getElementById("favId");
	var vfavType = document.getElementById("favType");
	var vfavProfileId = document.getElementById("favProfileId");
	var vfavAct = document.getElementById("favAct");

	vfavId.value = favId;
	vfavType.value = favType;
	vfavAct.value='delFav';

	mForm.submit();
}

function blockMember(profile_id){
	var mForm = document.getElementById("formFav");
	var vfavProfileId = document.getElementById("favProfileId");
	var vfavAct = document.getElementById("favAct");

	vfavProfileId.value = profile_id;
	vfavAct.value='blockMember';

	mForm.submit();
}

var inv_was_sent = false;
function inviteMember(profile_id){
	if (inv_was_sent) return false;;
	inv_was_sent = true;
	var mForm = document.getElementById("formFav");
	var vfavProfileId = document.getElementById("favProfileId");
	var vfavAct = document.getElementById("favAct");

	vfavProfileId.value = profile_id;
	vfavAct.value='inviteMember';

	mForm.submit();
}
function removeMember(profile_id){
	var mForm = document.getElementById("formFav");
	var vfavProfileId = document.getElementById("favProfileId");
	var vfavAct = document.getElementById("favAct");

	vfavProfileId.value = profile_id;
	vfavAct.value='removeMember';

	mForm.submit();
}

function unblockMember(profile_id){
	var mForm = document.getElementById("formFav");
	var vfavProfileId = document.getElementById("favProfileId");
	var vfavAct = document.getElementById("favAct");

	vfavProfileId.value = profile_id;
	vfavAct.value='unblockMember';

	mForm.submit();
}

function addBlock(profile)
{
	var msgText;
	if (talentBlocked)
	{
		msgText = ' Are you sure you want to unblock this member?';
	}
	else
	{
		msgText = 'When you block a member, they lose access to your portfolio and photos and cannot message you. You will be invisible to them on Talent6. They will appear in your Block List in the Community Section of the site. Are you sure you want to block this member?';
	}
	if (confirm(msgText))	{
		var mForm = document.getElementById("sMenuForm");
		document.getElementById("blockPrId").value=profile;
		mForm.submit();
	}

}

function browser()
{
	if(navigator.appName == "Microsoft Internet Explorer" || (navigator.appName=='Netscape' && navigator.vendor=='Apple Computer, Inc.'))
		return true;
	else
		return false;
}

function addCommas (n) {

	n += '';
	x = n.split ('.');
	x1 = x[0];
	x2 = x.length > 1 ? '.' + x[1] : '';
	var rgx = /(\d+)(\d{3})/;
	while (rgx.test (x1)) {
		x1 = x1.replace (rgx,'$1'+','+'$2');
	}
	return x1 + x2;
}

function correctInput (el,e, id) {

	var val = el.value;
		val = val.replace (/[^0-9]+/g,"");
		el.value = val;
	if (el.getAttribute('total_pages')) {
    	var max_value = parseInt(el.getAttribute('total_pages'));
    	if (val && max_value) {
			if (parseInt(val) > max_value || parseInt(val) < 1) {
				val = max_value;//val.substr(0, (val.length - 1));
				el.value = val;
			}
		}
 	}
}

function correctCalcInput (el) {

	var val = el.value;
	val = val.replace (/[^0-9]+/g,"");
	if (val) {
		if (parseInt(val) > 31 || parseInt(val) < 1) {
			val = val.substr(0, (val.length - 1));
		}
	}
	el.value = val;
}

function correctInputPhone (el) {

	var val = el.value;
		val = val.replace (/[^0-9\/()\- ]+/g,"");
		el.value = val;
}


function moneyToInt (n) {

	n = n.replace (/\.00$/,"");
	n = n.replace (/[^0-9]+/g,"");
	return n;
}

function calculator (act) {

	var averageCC = moneyToInt (document.getElementById ('averageCC').value);
	var CCpermonth = moneyToInt (document.getElementById ('CCpermonth').value);
	if (!(CCpermonth > 0 && averageCC > 0 && CCpermonth <= 31)) {
		window.alert ("Please enter the number of days per month you would like to work\n and the average pay for those jobs.");
		document.getElementById ('averageCC').focus ();
	} else {

		if (act == 'total') {
			document.getElementById ('hoursmonth').innerHTML = '<span class="calc"><b>'+(2 * CCpermonth)+'</b></span> hours per month';
			document.getElementById ('totalhoursmonth').innerHTML = '<span class="calc"><b>'+(2 * CCpermonth + 2.5)+'</b></span> hours';
			var yeartotal12Val = (averageCC * CCpermonth) * 12;
			var yeartotal6Val = (averageCC * CCpermonth) * 6;
			var yeartotal3Val = (averageCC * CCpermonth) * 3;
			var yeartotal1Val = (averageCC * CCpermonth) * 1;
			var yeartotal05Val = (averageCC * CCpermonth) / (CCpermonth * 2 + 2.5);

			document.getElementById ('attendTo').innerHTML = '<b>attend '+CCpermonth+'</b> casting call'+((CCpermonth > 1) ? 's' : '');
			document.getElementById ('attendToCC').innerHTML = '<span class="calc"><b>'+(CCpermonth*document.getElementById ('averageToApply').value)+'</b></span> Casting Calls';
			document.getElementById ('totalTime').innerHTML = 'Total time (<b>'+(2 * CCpermonth)+'</b> hours + <b>5</b> min * <b>30</b> Days):';

			if (document.getElementById ('yeartotal12')) {
				document.getElementById ('yeartotal12').innerHTML = '$'+addCommas (Math.floor (yeartotal12Val))+'.00';
			}
			if (document.getElementById ('yeartotal6')) {
				document.getElementById ('yeartotal6').innerHTML = '$'+addCommas (Math.floor (yeartotal6Val))+'.00';
			}
			if (document.getElementById ('yeartotal3')) {
				document.getElementById ('yeartotal3').innerHTML = '$'+addCommas (Math.floor (yeartotal3Val))+'.00';
			}
			if (document.getElementById ('yeartotal1')) {
				document.getElementById ('yeartotal1').innerHTML = '$'+addCommas (Math.floor (yeartotal1Val))+'.00';
			}
			var perhour = addCommas (Math.round (yeartotal05Val * 100) / 100);
			if (/\.[0-9]{1}$/.test (perhour)) {
				perhour += '0';
			} else if (!(/\.[0-9]{1,2}$/.test (perhour))) {
				perhour += '.00';
			}
			if (document.getElementById ('yeartotal05')) {
				document.getElementById ('yeartotal05').innerHTML = '$'+perhour;
			}
		}
	}
}

function usa_map_highlight (el,h) {
	if (h) {
		document.getElementById ('img').src = "i/map/"+((usa_map == "small") ? "small/" : "")+"usa_map_"+el.alt+".gif";
	} else {
		document.getElementById ('img').src = "i/map/"+((usa_map == "small") ? "small/" : "")+"usa_map.gif";
	}
}

function getRadioValue( radio )
{
  var val = false ;
  for( i=0 ; i < radio . length ; i++ )
  {
    if ( radio [ i ] . checked )
    {
      val =   radio [ i ] . value  ;
    }
  }
  return val ;
}


function showProgressBar ( )
{
  var popW=400;
  var popH=230;
	w = window.screen.width;
	h = window.screen.height;

	popW = popW +6;
	popH = popH+45;

	var leftPos = (w-popW)/2;
	var topPos = (h-popH)/2;
	var options = 'width=' + popW + ',height=' + popH + ',top=' + topPos + ',left='+leftPos + ',resizable=1, status=0, titlebar=0';
	if (document.getElementById ('audio').checked === true)
		var k = window.open('norw/progressbar.php?type=audio','progressbar',options);
	else
		var k = window.open('norw/progressbar.php?type=video','progressbar',options);
	k.resizeTo(popW,popH);
}

function send2friend(lnk,sysuser){
  var myUrl = "send2friend.php?link=" + lnk + "&sysuser=" + sysuser;
  height = ((screen.height-500)/5);
  width = ((screen.width-400)/2);
	myWin=window.open(myUrl, "wind_send2friend", "width=400,height=500,left="+width+",top="+height+",resizable=no,scrollbars=no,menubar=no");
}

function send2friend_movie_review(lnk,sysuser){
  var myUrl = "send2friend_movie_review.php?link=" + lnk + "&sysuser=" + sysuser;
  height = ((screen.height-500)/5);
  width = ((screen.width-400)/2);
	myWin=window.open(myUrl, "wind_send2friend_movie_review", "width=400,height=500,left="+width+",top="+height+",resizable=no,scrollbars=no,menubar=no");
}

function send2friend_audio(id,sysuser){
  var myUrl = "send2friend_audio.php?id=" + id + "&sysuser=" + sysuser;
  height = ((screen.height-500)/5);
  width = ((screen.width-400)/2);
  myWin=window.open(myUrl, "wind_send2friend_audio", "width=400,height=500,left="+width+",top="+height+",resizable=no,scrollbars=no,menubar=no");
}

function postForumMessage(forum_id,sysuser){
  var myUrl = "norw/postForumMessage.php?forum_id=" + forum_id + "&sysuser=" + sysuser;
  height = ((screen.height-320)/5);
  width = ((screen.width-320)/2);
  myWin=window.open(myUrl, "postForumMessage", "width=400,height=320,left="+width+",top="+height+",resizable=no,scrollbars=no,menubar=no");
}

function checkEnabled ( elem_input , elem_button )
{
  if ( document.getElementById ( elem_input ).value )
  {
    document.getElementById ( elem_button ).disabled = false ;
  }
  else document.getElementById ( elem_button ).disabled = true ;
}

function counterSwap ( elem )
{
  if ( elem != counter )
  {
    document . getElementById ( counter + '_lnk' ) . style . fontWeight = 'normal' ;
    document . getElementById ( elem + '_lnk' ) . style . fontWeight = 'bold' ;
    document . getElementById ( counter ) . style . display = 'none' ;
    document . getElementById ( elem ) . style . display = '' ;
    counter = elem ;
  }
}

function aliasWanted(aliasId, boxId) {
	var alias = document.getElementById(aliasId);
	var box = document.getElementById(boxId);
	
	if (alias != null) {
		if (alias.value) {
			box.disabled = false;
		} else {
			box.disabled = true;
			box.checked = false;
		}
	}
}

function messageDisclaimer(disclaimer,reply,fake_reply)
{
	if (document.getElementById(disclaimer).checked)
	{
		document.getElementById(reply).style.display="";
		document.getElementById(fake_reply).style.display="none";
	}
	else
	{
		document.getElementById(reply).style.display="none";
		document.getElementById(fake_reply).style.display="";
	}
}

function openSendMsgDialog(talent_name, talent_pr_id, photographer)
{
    if (document.getElementById('msgModal').className != 'modal')
    {
        return false;
    }
	sname = talent_name;
	pr_id = talent_pr_id;

	if ((photographer == 0) || (typeof photographer == 'undefined'))
	{
	   document.getElementById('sPhotoDiscl').style.display    = 'none';
	   document.getElementById('sPhotoDiscl').style.visibility = 'hidden';
	}
	else
	{
	   document.getElementById('sPhotoDiscl').style.display    = '';
	   document.getElementById('sPhotoDiscl').style.visibility = '';
	}
	document.getElementById("sMessageTo").innerHTML = '<b><big>To: ' + sname + '</big></b>';
	document.getElementById('communityCnt').innerHTML = '500';
	modal.open('msgModal');
}

function freshMeat_ChangeTexts(is_already_welcomed)
{
	if (document.getElementById('msgModal').className == 'modal')
	{
		if (is_already_welcomed == 1)
		{
			document.getElementById('id_title_send_message').innerHTML = 'Send Personal Message';
			document.getElementById('community').value = '';
			document.getElementById('community').defaultValue = document.getElementById('community').value;
		}
		else
		{
			document.getElementById('id_title_send_message').innerHTML = 'Welcome New Member';
			document.getElementById('community').value = '';
			document.getElementById('community').defaultValue = '';
		}
	}
	else
	{
	    return false;
	}
}

function txtCount(in_elem_name,out_elem_name,maxChr)
{
	var txt = document.getElementById(in_elem_name).value;
	var cnt = document.getElementById(out_elem_name);
	var total = maxChr--;

	if(txt.length > total)
		document.getElementById(in_elem_name).value = txt.substr(0,total);
	else {
		cnt.innerHTML = total - txt.length;
		maxChr--;
	}
}

function startRun(th){
	th.scrollAmount = 3;
	/*txt='';
	for(i in th){
		txt += i+' : '+th[i]+' ; ';
	}alert(txt);*/
}
							
function endRun(th){
	th.scrollAmount = 0;
}

var http_request = false;
var div_id = false;

function catchSize(div)
{
	var id=document.getElementById(div);
	id.style.height=id.offsetHeight+'px';
	id.style.width=id.offsetWidth+'px';
}

function AjaxDo(url,divid, loading) {

	div_id = divid;
	http_request = false;
	
	if(typeof loading == 'undefined' || loading=='') {
		document.getElementById(div_id).innerHTML = '<img src="images/loading.gif" />';
	} else {
		document.getElementById(div_id).innerHTML = '<img src="images/loading.gif" style="position:relative; top:'+((document.getElementById(div_id).offsetHeight/2)-16)+'px; left:'+((document.getElementById(div_id).offsetWidth/2)-16)+'px;" />';
	}

	if (window.XMLHttpRequest)
	{
		http_request = new XMLHttpRequest();
		if (http_request.overrideMimeType)
			{ http_request.overrideMimeType('text/xml') }
	}
	else if (window.ActiveXObject)
	{
		try { http_request = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) {
			try { http_request = new ActiveXObject("Microsoft.XMLHTTP"); }
				catch (e) {}
		}
	}

	if (!http_request)
	{
		//alert('ERROR:(XMLHTTP::instance)');
		return false;
	}
	http_request.onreadystatechange = alertContents;
	http_request.open('GET', url, true);
	http_request.send(null);
}

function alertContents() {
	if (http_request.readyState == 4)
	{
		if (http_request.status == 200) 
			{
				// alert('div_id: '+div_id + "\n" + 'http_request.responseText: ' + http_request.responseText);
				document.getElementById(div_id).innerHTML = http_request.responseText;
				document.getElementById(div_id).style.height='';
				document.getElementById(div_id).style.width='';
			}
		/*else
			{ alert('ERROR:(request)'); }*/
	}
}

function changeCat(type)
	{
		if(type == "audio")
		{
		  document.getElementById("audioCat").style.display = "block";
			document.getElementById("videoCat").style.display = "none";
			document.getElementById("audioCat").disabled = false;
			document.getElementById("videoCat").disabled = true;
		} else {
			document.getElementById("videoCat").style.display = "block";
			document.getElementById("audioCat").style.display = "none";
			document.getElementById("videoCat").disabled = false;
			document.getElementById("audioCat").disabled = true;
			
		}
	}
	
function giveLogin() {
	var a;
	a=document.getElementById('loginDiv');
	z=a.style.top;
	z=z.replace("px","");
	zz=parseInt(z);
	if(zz<5){
		a.style.top=(zz+5)+'px';
	}else {
		clearInterval(loginInt);
	}
}

function show_welcome_tutorial(opt) {
	var url = '';
	var nsw = 0;
	if (document.getElementById('never_show_welcome').checked) {
		nsw = 1;
	}
	if (opt == 'Yes') {
		url = 'resource.php?name=0&nsw='+nsw;
	}
	if (opt == 'No') {
		if (nsw) {
			url = 'my_talent6.php?nsw='+nsw;
		}
		else {
			myAlert.close();
			return false;
		}
	}
	window.location.href = url;
}

function show_blog_text(nr, show) {
	if (show) {
		document.getElementById('blog_preview_text'+nr).style.display='none';
		document.getElementById('blog_full_text'+nr).style.display='';
		document.getElementById('blog_link_more'+nr).style.display='none';
		document.getElementById('blog_link_less'+nr).style.display='';
	} else {
		document.getElementById('blog_preview_text'+nr).style.display='';
		document.getElementById('blog_full_text'+nr).style.display='none';
		document.getElementById('blog_link_more'+nr).style.display='';
		document.getElementById('blog_link_less'+nr).style.display='none';
	}
}

function changePhtotoType() {
	var obj = document.getElementById("type");
	var index = obj.selectedIndex;
	var s = obj.options[index].value;
	if (s == 5) {
		document.getElementById('photo_descr1').style.display = 'block';
		document.getElementById('photo_descr2').style.display = 'block';
	}
	else {
		document.getElementById('photo_descr1').style.display = 'none';
		document.getElementById('photo_descr2').style.display = 'none';
	}
}

function Get_Cookie( name ) {
	var start = document.cookie.indexOf( name + "=" );
	var len = start + name.length + 1;
	if ( ( !start ) &&
	( name != document.cookie.substring( 0, name.length ) ) )
	{
	return null;
	}
	if ( start == -1 ) return null;
	var end = document.cookie.indexOf( ";", len );
	if ( end == -1 ) end = document.cookie.length;
	return unescape( document.cookie.substring( len, end ) );
}

function ajax_do(url) {
    var jsel = document.createElement('SCRIPT');
    jsel.type = 'text/javascript';

    jsel.src = url;

    document.body.appendChild (jsel);
}

function strokeEnter(e, objForm) {
	var keynum;
	if(window.event) {
	  keynum = e.keyCode;
	}
	else if(e.which) {
	  keynum = e.which;
	}
	if (keynum == 13 && objForm) {
		objForm.submit();
	}
}
