﻿//To toggle Code area
function toggleCode(code, codeexpandimg, codeexpandtext){
  var codevar=document.getElementById(code);
  var codeexpandimgvar = document.getElementById(codeexpandimg);
  var codeexpandtextvar = document.getElementById(codeexpandtext);
  
  if(!codevar)return true;
  if(codevar.style.display=="none"){
    codevar.style.display="block"
    codeexpandimgvar.src = "http://www.sqllion.com/wp-content/uploads/collapseminus.gif"
    codeexpandtextvar.innerHTML = "Collapse"
    
  } else {
    codevar.style.display="none"
    codeexpandimgvar.src = "http://www.sqllion.com/wp-content/uploads/expandplus.gif"
	codeexpandtextvar.innerHTML = "Expand"

  }
  return true;
}

//To show code in popup box
function showCode(code)
{
	if(document.all)
	{
	day = new Date();
	WinID = window.open('about:blank', 'SampleCode', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=500,height=400,left = 470,top = 250');
	
	WinID.document.write('<html><head><title>SQL Lion - Sample Code ( ' + day.toDateString() + ')</title></head><body>'+
	'<textarea style="width:99%;height:99%">\n'+
	document.getElementById(code).innerText+
	'\n</textarea>'+
	'</body>');
	}
	else
	{
	day = new Date();
	WinID = window.open('about:blank', 'SampleCode', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=500,height=400,left = 470,top = 250');
	
	WinID.document.write('<html><head><title>SQL Lion - Sample Code ( ' + day.toDateString() + ')</title></head><body>'+
	'<textarea style="width:99%;height:99%">\n'+
	document.getElementById(code).textContent+
	'\n</textarea>'+
	'</body>');
	
	WinID.focus();

	}
}

//To copy code to clipboard
function copyClipCode(code)
{
if(document.all)
{
  window.clipboardData.setData('Text',document.getElementById(code).innerText);
  alert("Successfully copied to the Clip Board");
  }
  else
  {
  	alert("'Copy to ClipBoard' option is only available for Internet Explorer Browser !");
   }
    
}

//Code Ends
