function selectCode(ta){
	document.getElementById(ta).select();
}

function showSC(idc){
	var a,b,c,d,e,f;
	a = 'sco' + idc;
	b = document.getElementById(a).style.display;
	c = 'txt' + idc;
	d = document.getElementById(c);
	e = 'but' + idc;
	f = document.getElementById(e);
	if(d.innerHTML == "Show"){
		d.innerHTML = "Hide";
		f.setAttribute("class", "selected");
	}else if(d.innerHTML == "Hide"){
		d.innerHTML = "Show";
		f.setAttribute("class", "");
	}
}

function alertFB(){
	var answer = confirm("You will be redirected to Facebook now, as we need your permission to access your profile. Once you grant us permission, we will create an album (" + _sitealbum +") in your Facebook Profile and upload this picture to that Album. You can read our Privacy Policy for more information. Your data will be kept private & safe. \n\nPress OK to continue.");
	if (answer){
		return true;
	}else{
		return false;
	}
}

function toggleMsg(alertid){
	$(alertid).slideToggle("slow");
}

function ajaxfbpost(sid){
	var loaderid = 'los' + sid;
	var tipid = 'los' + sid;
	var alertid = 'fbd' + sid;
	var alert2id = '#fbd' + sid;
	document.getElementById(tipid).style.display = 'none';
	document.getElementById(loaderid).innerHTML = '<div class="loader"><img src="/i/b.gif"></div>';
	var ajaxurl = '/auth/ajaxfbpost';
	var getHtml = $.ajax({
    		type: 'POST',
		data: 'hash='+ _sitetoken +'&key=' + _sitekey + '&task=poststatus&taskid='+sid,
    		url: ajaxurl,
    		async: false
    	}).responseText;
	if(getHtml){
		document.getElementById(loaderid).innerHTML = '';
		document.getElementById(alertid).innerHTML = getHtml;
		toggleMsg(alert2id);
		setTimeout('$('+alertid+').slideToggle("slow")', 10000);
	}
}

function sidefbpost(sid){
	var loaderid = 'slos';
	document.getElementById(loaderid).innerHTML = '<div class="loader"><img src="/i/b.gif"></div>';
	var ajaxurl = '/auth/ajaxfbpost';
	var getHtml = $.ajax({
    		type: 'POST',
		data: 'hash='+ _sitetoken +'&key=' + _sitekey + '&task=poststatus&taskid='+sid,
    		url: ajaxurl,
    		async: false
    	}).responseText;
	if(getHtml){
		document.getElementById(loaderid).innerHTML = '';
		document.getElementById("spfb").innerHTML = '<div class="pt2 dib"><img src="/i/b.gif" class="sp sico scrtic"></div><div class="dib">Added to Facebook</div>';
	}
}

