// JScript File
//JS scripting taken from modified versions of publically available scripts on various forums and javascript resources found at the following locations:
//http://www.webmasterworld.com/forum91/441.htm
//http://www.javascriptjunkie.com/?p=9
//Other FREE javascript resources can be found here:
//http://javascript.internet.com/
//http://www.javascriptfreecode.com/
//http://www.web-source.net/javascript_codes.htm
function bookmark()
{
    if (window.external)
    {
        window.external.AddFavorite(location.href, document.title);
    }
    else
    {
        alert("CTRL+D to add a bookmark to this site.");
    }
}

function showVoucher(id, url)
{
	document.getElementById('Voucherhide'+id).style.display='none';
	document.getElementById('Vouchershow'+id).style.display='block';
	new_win = window.open(url,'_blank','toolbar=1,location=1,directories=1,status=1,menubar=1,scrollbars=1,resizable=1');
    new_win.blur();
}

function hideVoucher(id)
{
	document.getElementById('Voucherhide'+id).style.display='block';
	document.getElementById('Vouchershow'+id).style.display='none';
	
}

function showComments(id)
{
	document.getElementById('commentsPanel'+id).style.display='block';		
}

function hideComments(id)
{
	document.getElementById('commentsPanel'+id).style.display='none';		
}

function showAddComments(id)
{
	document.getElementById('addcomments'+id).style.display='block';		
}

function hideAddComments(id)
{
	document.getElementById('addcomments'+id).style.display='none';		
}

function showSendtoFriend(id)
{
    document.getElementById('sendtofriend'+id).style.display='block';		
	
}


function hideSendtoFriend(id)
{
	document.getElementById('sendtofriend'+id).style.display='none';		
}


function WorkingClick(id)
{

	window.location('http://www.couponcodesusa.com/retailer_vouchers.aspx?working=true&oid='+id,'_parent','toolbar=1,location=1,directories=1,status=1,menubar=1,scrollbars=1,resizable=1');

}

function NotWorkingClick(id)
{

	window.location('http://www.couponcodesusa.com/retailer_vouchers.aspx?working=false&oid='+id,'_parent','toolbar=1,location=1,directories=1,status=1,menubar=1,scrollbars=1,resizable=1');

}


 function GoToRetailer(RetailerWebPage, OurRetailerPage)
{
	window.location = OurRetailerPage;
}

function OpenRetailer()
{



// alert(unescape(trackinglink));
  
 var  myOldString = window.location.toString();
//Old versionvar myNewString = myOldString.replace(/-codes/, "-information");

//New version
var myNewString = myOldString.replace(/-discounts/, "-voucher\-information");

 	new_win = window.open(myNewString,'_blank','toolbar=1,location=1,directories=1,status=1,menubar=1,scrollbars=1,resizable=1');
 	new_win.blur();
	
}

function OpenRetailerLink()
{


    url = window.location.toString().split("/");


   var retailer = url[4];
   //alert(retailer);

 var myNewString = 'http://www.couponcodesusa.com/voucher-information/' + retailer;


  	new_win = window.open(myNewString,'_blank','toolbar=1,location=1,directories=1,status=1,menubar=1,scrollbars=1,resizable=1');
 	new_win.blur();
	
}

function OpenRetailerLinkCompetition()
{



var urlParameters = window.location.search.substring(1);
var parameterPair = urlParameters.split('&');
var pos = parameterPair[1].indexOf('=');
var argName = parameterPair[1].substring(1, pos);
var argVal = parameterPair[1].substring(pos + 1);

 var myNewString = 'http://www.couponcodesusa.com/voucher-information/' + argVal;


  	new_win = window.open(myNewString,'_blank','toolbar=1,location=1,directories=1,status=1,menubar=1,scrollbars=1,resizable=1');
 	new_win.blur();
	
}

function sendToClipboard(s) 
{ 
if( window.clipboardData && clipboardData.setData ) 
{ 
clipboardData.setData("Text", s); 
} 
else 
{ 
alert("Internet Explorer required"); 
} 
} 
