﻿// JScript File
function getPrintVersion()
	{
		if (document.getElementById != null)
		{
		   
			var html = '<HTML>\n<HEAD>\n';
			if (document.getElementsByTagName != null)
			{
				var headTags = document.getElementsByTagName("head");
				if (headTags.length > 0)
					html += headTags[0].innerHTML;
			}
			html += '\n<script language = "javascript">';
			html += '\n function printWindow()\n{';
			html += '\nwindow.parent.close(); var printReadyEle = document.getElementById("ctl00_ContentPlaceHolder1_printContent");\nvar shtml = \'<HTML>\\n<HEAD>\\n\';\nif (document.getElementsByTagName != null)\n{\nvar sheadTags = document.getElementsByTagName("head");\nif (sheadTags.length > 0)\nshtml += sheadTags[0].innerHTML;\n}\nshtml += \'</HEAD>\\n<BODY>\\n\';\nif (printReadyEle != null)\n{\n';
			html += 'shtml += \'<form name = frmform1>\';\nshtml += printReadyEle.innerHTML;\n}\nshtml += \'\\n</form>\\n</BODY>\\n</HTML>\';\nvar printWin1 = window.open();\nprintWin1.document.open();\nprintWin1.document.write(shtml);\nprintWin1.document.close();\nprintWin1.print();';
			html += '\n}\n</script>\n</HEAD>\n<BODY>\n';

			var printReadyElement1 = document.getElementById("ctl00_ContentPlaceHolder1_printContent");
			/*var printReadyElement2 = document.getElementById("ctl00_ContentPlaceHolder1_printContent");*/
			if (printReadyElement1 != null)
			{
				html += '<form name = frmform>';
				html += '\n<div id = printContent>\n<table cellspacing = 0 cellpadding = 0 width = 750px class=grayBG>\n<tr>\n<td >Source : Modeling Corner (<a href = "http://www.modelingcorner.com" class = specific>www.modelingcorner.com</a>)</td><td align=right><input type = button value = Print class = commonTextBoxStyle  onclick = "printWindow();"> </td>\n</tr>\n</table>\n';
				html += '<TABLE cellSpacing=0 cellPadding=10 width=750px border=0>\n<TR>\n<TD class=tblArticleHeadingBG>\n';
				html += printReadyElement1.innerHTML;
				html += '\n</td>\n</tr>\n</table>';
				html += '\n<table cellspacing = 0 cellpadding = 0 width = 750px>\n<tr class=grayBG>\n<td>&nbsp;</td>\n</td>\n</tr>\n</table>\n';
				/*if(printReadyElement2 != null)
				{
					html += '<TABLE cellSpacing=0 cellPadding=10 width=750px border=0 align = center>\n<TR>\n<TD>\n';
					html += printReadyElement2.innerHTML;
					html += '\n</td>\n</tr>\n</table>\n\n';
					html += '\n<table cellspacing = 0 cellpadding = 0 width = 750px>\n<tr>\n<td class=grayBG>Thank you for using modelingcorner.com</td>\n</tr>\n</table>\n';
				}
				else
				{
					alert("This article doesn't contains any content! Sorry for inconvenience");
					return;
				}*/
			}
			else
			{
				/* alert("pppp");			 */
				return;
			}

			html += '\n</div>\n</form>\n</BODY>\n</HTML>';

			var printWin = window.open();
			printWin.document.open();
			printWin.document.write(html);
			
		}
		else
		{
			alert("The print ready feature is only available if you are using an browser. Please update your browswer.");
		}
	}

var check = 'full';
function CheckUnCheck(ctrlName,temp,count)
{   
    
    var table = document.getElementById (ctrlName);
    var cells = table.getElementsByTagName("td");		
    var ctlr;
    var numberChecks = 0;
    if ( check == 'empty')
    {
	    for (var i = 0; i < count; i ++)
	    {
		    ctrl = cells[i].firstChild;
		    if (ctrl.type == 'checkbox')
		    {
			    if(document.getElementById(ctrlName+"_0").checked == true)
			    {
				    ctrl.checked = true;							 
				    if(i == count - 1)
					    check = 'full';
			    }
		    }
	    }
    }
    else if ( check == 'full')
    {
	    for (var i = 0; i < count; i++)
	    {
		    ctrl = cells[i].firstChild;
		    if (ctrl.type == 'checkbox')
		    {
			    if(document.getElementById(ctrlName+"_0").checked == false)
			    {
				    ctrl.checked = false; 
			    }
			    else
			    {
				    if(i == count - 1)
					    document.getElementById(ctrlName+"_0").checked = false;
			    }
			    if(i == count -1)
			    {
				    check = 'empty';						
			    }
		    }
	    }
    }				
    for (var i = 1; i < count; i++)
    {
	    ctrl = cells[i].firstChild;
	    if (ctrl.type == 'checkbox')
	    {
		    if ( ctrl.checked == true)
			    numberChecks ++;
		    if ( ctrl.checked == false)
			    numberChecks --;
	    }
    }				
    if ( numberChecks == count - 1)
    {
	    document.getElementById(ctrlName+"_0").checked = true;
	    check = 'full';
    }
}

function OpenUserListLookup(qstring)
{
	window.open("Album.aspx?"+qstring,'Lookup','status=on,scrollbars=yes,resizable=Yes,height=700,width=1000,screenX=0,screenY=0');
}

function OpenUserListLookupAllPictures(qstring)
{
   	newwindow=window.open(qstring,'name','height=550,width=550,resizable=Yes,scrollbars=yes,top=10,left=10');
	if (window.focus) {newwindow.focus()}
}
function CommentMsg()
{
    alert("Sorry! You cannot post comments to your own profile");
    return;
}
function RateMsg()
{
    alert("Sorry! You cannot rate to your own profile");
    return;
}
function EmailMsg()
{
    alert("Sorry! You cannot send mail to your own profile");
    return;
}

 function confirm_delete()
 {
    if (confirm("Are you sure to delete the record ?")==true)
        return true;
    else
        return false;
 }
 
 function ActiveMsg()
{
    alert("You do not have permission to send messages. This is either because your account hasn't been approved yet or it has been denied.");
    return;
}

 function GuestEmailMsg()
{
    alert("You do not have permission to send messages.");     
}
 function GuestFriendRequest()
{
    alert("You do not have permission to send Friend Request.");     
}

function funTrapKD(btn, event)
{
 if (document.all)
 {
	if (event.keyCode == 13)
	{
		event.returnValue=false;
		event.cancel = true;
		btn.click();
	}
 }
 else if (document.getElementById)
 {
	if (event.which == 13)
	{
		event.returnValue=false;
		event.cancel = true;
		btn.click();
	}
 }
 else if(document.layers)
 {
	if(event.which == 13)
	{
		event.returnValue=false;
		event.cancel = true;
		btn.click();
	}
 }
}

function CharCount(textbox, label)
{			   
	if (document.getElementById(textbox) != null && document.getElementById(label) != null)
    {					
		document.getElementById(label).innerText = document.getElementById(textbox).value.length + 1;
	}
}

function BlogCommentMsg()
{
    alert("Sorry! You cannot post comments to your own Blog");
}
 function resize(which, max) 
 { 
    var elem = document.getElementById(which);  
    if (elem == undefined || elem == null) 
        return false;
    if (max == undefined) max = 750;
    if (elem.width > elem.height) 
    {
      if (elem.width> max) elem.width = max;  
    }
    else
    {
     if (elem.height> max) elem.height = max;   
    }  
 }
 function ModelCasting()
 {
    alert("You are not permitted to post casting");
 }
 function UserFavourite()
 {
  alert("Profile has been added to your favourite list");
  return;
 }
 function FavouriteProfile()
 {
  alert("Already in favourite list");
  return;
 }

  
     




