﻿jQuery.fn.opensInNewWindow = function() {
    var opt = arguments[0];
    if (opt == null) { opt = 'width=567,height=630,scrollbars=1,resizable=1,toolbar=0,location=0,directories=0,status=0,menubar=0'; }
    return this.each(function() {
        $(this).click(function() { var gj = window.open($(this).attr('href'), '', opt); gj.focus(); return false; }).removeAttr('target');
    });
};

 /* $.copy('some text here') */
jQuery.copy = function(t) {
	if(typeof t=='undefined') { t=''; }
	d = document;
	if (window.clipboardData) {
		window.clipboardData.setData('Text',t);
	} else {
		var f='flashcopier';
		if(!d.getElementById(f)) {
			var dd = d.createElement('div');
			dd.id = f;
			d.body.appendChild(dd);
		}
		d.getElementById(f).innerHTML = '';
		var i = '<object data="/affiliates/assets/media/copy.swf" type="application/x-shockwave-flash" width="0" height="0"><param name="movie" value="/affiliates/assets/media/copy.swf" /><param name="FlashVars" value="clipboard=' + encodeURIComponent(t) + '" /><embed src="/affiliates/assets/media/copy.swf" FlashVars="clipboard=' + encodeURIComponent(t) + '" width="0" height="0" type="application/x-shockwave-flash"></embed></object>';
		d.getElementById(f).innerHTML = i;
	}
}

$(function(){
	$(".popreq").opensInNewWindow();
});

