﻿function CallPrint() {
    var prtContent = document.getElementById('printareaid');
     //if(prtContent!=null)
    var WinPrint = window.open('', '', 'resizable=yes,letf=0,top=0,width=800,height=600,toolbar=0,scrollbars=1,status=0');
  
  WinPrint.document.write("<head><meta http-equiv='Content-Type' content='text/html; charset=utf-8' /><title>Print Window</title><link href='css/style.css' rel='stylesheet' type='text/css' /></head>");

 // alert("Test");
  
    WinPrint.document.write("<input type='button' value='Print' onclick='window.print();'></br>");
    WinPrint.document.write(prtContent.innerHTML);  
    
    WinPrint.document.close();    
    WinPrint.focus(); 
    //prtContent.innerHTML = strOldOne;
    return false;
}

function Download(Pageurl) {
    //alert(Pageurl);
    window.open(Pageurl, '', 'letf=0,top=0,width=800,height=600,toolbar=0,scrollbars=0,status=0');
    return false;

}

function CallAuthenticationFunction() {
    alert('You are not authenticated user to rate this article.');
    return false;
}
	
	function OpenShareLinkPage(PageUrl, Link, UserStatus)
	{
	
		if(UserStatus != 'True')
		{
			alert('Please login/register to post your feedback.');
		}
		else
		{
			PageUrl = PageUrl + '/Shared%20Documents/ShareLink.aspx';
			//alert(ItemID + PageUrl);
			window.showModalDialog(PageUrl + '?Link=' + Link + '', null, 'toolbar:0;location:0;directories:0;menubar:0;status:no;dialogWidth:500px;dialogHeight:150px;dialogHide:true;help:no;scroll:no');
			//window.location.href = window.location.href;
		}
	}

	function OpenPostCommentPage(ItemID, PageUrl, UserStatus)
	{
		if(UserStatus != 'True')
		{
			alert('Please login/register to post your feedback.');
		}
		else
		{
			PageUrl = PageUrl + '/Shared%20Documents/PostFeedback.aspx';
			//alert(ItemID + PageUrl);
			window.showModalDialog(PageUrl + '?ItemID=' + ItemID+ '', null, 'toolbar:0;location:0;directories:0;menubar:0;status:no;dialogWidth:600px;dialogHeight:300px;dialogHide:true;help:no;scroll:no');
			window.location.href = window.location.href;
		}
	}
	
	function OpenRatingPage(PageUrl, ItemID, ListID, UserStatus)
	{
		if(UserStatus != 'True')
		{
			alert('Please login/register to rate.');		
		}
		else
		{
			//alert(PageUrl + '?ListID=' + ListID+ '&ItemID=' + ItemID +'');
			PageUrl = PageUrl + '/Shared%20Documents/UserRating.aspx';
			window.showModalDialog(PageUrl + '?ListID=' + ListID+ '&ItemID=' + ItemID +'', null, 'toolbar:0;location:0;directories:0;menubar:0;status:no;dialogWidth:70px;dialogHeight:50px;dialogHide:true;help:no;scroll:no');        	
			window.location.href = window.location.href;
		}
		
		//return false;
	}



function Confirmalertmessage(signin)
{
var  alerttext=document.getElementsByTagName('input');
var confirmMessage = false;


	for(var Count=0; Count<alerttext.length ; Count++ )
	{
	 if(alerttext[Count].attributes['type']!=null)
	 {
	  	var imagetype = alerttext[Count].attributes['type'].value;	          				
		if(imagetype =='image') 
		{
			
			 if(alerttext[Count].attributes['title'].value=="Alert Me")
		     {
		        if(signin != 'false')
			     {
			        confirmMessage=confirm("Are you sure to receive an alert if there is any new information in this section ?");
			     }
			    else if(signin != 'true')
			     {
			        alert("Plese login/signin for alert functionality.");
			     }
		     }
		     else if(alerttext[Count].attributes['title'].value=="Remove Alert")
		     {
		  	      confirmMessage=confirm("Are you sure to stop receiving an alert if any new information is added in this section ?");	     
		     }
		}	
	 } 
	}

if (confirmMessage)
  {
 // alert(confirmMessage);
  return true;
  }
else
  {
  return false;
  }
  
 // return confirmMessage;

}

/*
function Confirmalertmessage()
{
	//alert("Alert");
	
	var  alerttext=document.getElementsByTagName('input');
	var confirmMessage;
	//alert(alerttext);
	for(var Count=0; Count<alerttext.length ; Count++ )
	{
	 if(alerttext[Count].attributes['type']!=null)
	 {
	  	var imagetype = alerttext[Count].attributes['type'].value;	          				
		if(imagetype =='image') 
		{
			
			 if(alerttext[Count].attributes['title'].value=="Alert Me")
		     {
		     // alert(alerttext[Count].attributes['title'].value);
		     confirmMessage=confirm("Are you sure to receive an alert if there is any new information in this section ?");
		     }
		     else if(alerttext[Count].attributes['title'].value=="Remove Alert")
		     {
		    // alert(alerttext[Count].attributes['title'].value);
		      confirmMessage=confirm("Are you sure to stop receiving an alert if any new information is added in this section ?");	     
	
		     }
		}	
	 } 
	}
	if (confirmMessage)
	  {
	 // alert(confirmMessage);
	  return true;
	  }
	else
	  {
	  return false;
	  }
  
 // return confirmMessage;
}
*/

