function copy(text2copy) {
  if (window.clipboardData) {
    window.clipboardData.setData("Text",text2copy);
  } else {
    var flashcopier = 'flashcopier';
    if(!document.getElementById(flashcopier)) {
      var divholder = document.createElement('div');
      divholder.id = flashcopier;
      document.body.appendChild(divholder);
    }
    document.getElementById(flashcopier).innerHTML = '';
    var divinfo = '<embed src="_clipboard.swf" FlashVars="clipboard='+escape(text2copy)+'" width="0" height="0" type="application/x-shockwave-flash"></embed>';
    document.getElementById(flashcopier).innerHTML = divinfo;
  }
}

function VoteOption (poll, option, total) {

	$("#poll_" + poll).val(option);
	$("#poll_link_" + poll + "_" + option).attr('href', "javascript:VoteUnoption(" + poll + "," + option + "," + total + ")").css('font-weight', 'bold');
	
	for (count = 1;count <= total;count++) {
	
	if (count == option) {continue;}
	
	poll_link_id = "#poll_link_" + poll + "_" + count;
	
	$(poll_link_id).attr('href', "javascript:VoteOption(" + poll + "," + count + "," + total + ")").css('font-weight', 'normal');
	
	}

}

function VoteUnoption (poll, option, total) {

	$("#poll_" + poll).val('');
	$("#poll_link_" + poll + "_" + option).css('font-weight', 'normal').attr('href', "javascript:VoteOption(" + poll + "," + option + "," + total + ")");

}

function SubmitVote (pollid, options) {

	votes = new Array();

	for (count = 1; count <= options; count++) {
	
		vote = $("#poll_" + count).val();
		
		if (vote == "") {alert("You have not selected a response to each poll!"); return;}
		
		votes[count] = vote;
	
	}
	
	data = "";
	
	for (vid in votes) {data += vid + "=" + votes[vid] + "&";}
	
	data += "id=" + pollid;

    $.post(AjaxURL + 'poll', data, function (data) {ReturnGlobal(data);});


}

function BrowserResTest () {

	var width = screen.width;
	var height = screen.height;
	var error = "";
	var browser = navigator.userAgent.indexOf("Firefox");
	
	if (width < 1024 || height < 768) {
	error += "\n - Your screen resolution is smaller than 1024x768";
	}
	
	if (browser == -1) {
	error += "\n - You are not using Firefox";
	}
	
	if (error != "") {
	error2 = "This website is designed for optimal viewing using Mozilla Firefox, with resolutions of 1024x768 or higher.  The following errors were found:\n" + error + "\n\nPlease correct these errors for optimal viewing conditions.  This is not required, it is merely a recomendation.";
	document.getElementById('browserwarn').innerHTML = error2;
	document.getElementById('browserwarn').style.display = "block";
	}
	

}

function openWindow(url,w,h,tb,stb,l,mb,sb,rs,x,y){
var t=(document.layers)? ',screenX='+x+',screenY='+y: ',left='+x+',top='+y; //A LITTLE CROSS-BROWSER CODE FOR WINDOW POSITIONING
tb=(tb)?'yes':'no'; stb=(stb)?'yes':'no'; l=(l)?'yes':'no'; mb=(mb)?'yes':'no'; sb=(sb)?'yes':'no'; rs=(rs)?'yes':'no';
var x=window.open(url, 'newWin'+new Date().getTime(), 'scrollbars='+sb+',width='+w+',height='+h+',toolbar='+tb+',status='+stb+',menubar='+mb+',links='+l+',resizable='+rs+t);
x.focus();
}

function ReturnGlobal(response) {eval(response);}

function AffiliateOut (affid) {$.post(AjaxURL + 'affout', {affid:affid}, function (data) {ReturnGlobal(data);});}

function Logout () {$.post(AjaxURL + 'logout', {}, function (data) {ReturnGlobal(data);});}

function ISUpload (imgurl) {$.post(AjaxURL + 'imageshack_upload', {imgurl:imgurl}, function (data) {ReturnGlobal(data);});}

function ChangeSkin(skin) {$.post(AjaxURL + 'changeskin', {'do':'Yes', skin:skin}, function (data) {ReturnGlobal(data);});}