function cssClick(id)
{
	document.getElementById("folder").style.display = "none";
	document.getElementById("lifolder").style.display = "none";
	
	document.getElementById("tdAbout").className = "menuleft_text";
	document.getElementById("About").className = "menuleft_text";
	
	
	document.getElementById("tdWedInfo").className = "menuleft_text";
	document.getElementById("WedInfo").className = "menuleft_text";
	
	
	document.getElementById("tdGallery").className = "menuleft_text";
	document.getElementById("Gallery").className = "menuleft_text";
	
	
	document.getElementById("tdMyDiary").className = "menuleft_text";
	document.getElementById("MyDiary").className = "menuleft_text";
	
	
	document.getElementById("tdGuestBook").className = "menuleft_text";
	document.getElementById("GuestBook").className = "menuleft_text";
	
	if (id == "Gallery")
	{	
		if (document.getElementById("folder").innerHTML != "")
		{
			document.getElementById("folder").style.display = "block";
			document.getElementById("lifolder").style.display = "block";
		}
	}	
	
	document.getElementById("td" + id).className = "menuleft_textclick";
	document.getElementById(id).className = "menuleft_textclick";
}

function setHeaderGallery(stat,folderID)
{
	 $('#divHead').html('<a href="javascript:" onclick="loadPage(\'../templates/include/gallery.asp\',\'stat='+stat+'&folderID='+folderID+'\',\'content\');" class="article_title">gallery</a>')
	 //loadPage('../templates/include/gallery.asp','stat='+stat+'&folderID='+folderID,'content');
}
function hideDescription()
{
	document.getElementById('divDescription').style.display = "none";
}
function limitText(limitField, limitCount, limitNum) {
	if (limitField.value.length > limitNum) {
		limitField.value = limitField.value.substring(0, limitNum);
	} else {
		limitCount.value = limitNum - limitField.value.length;
	}
}

function showmenu(menu, image)
{
	//alert(document.getElementById(image).src);
	if (document.getElementById(menu).style.display == "none")
	{
		document.getElementById(menu).style.display = "block";
		document.getElementById(image).src = '../templates/i/li_down.gif';
	}
	else
	{
		document.getElementById(menu).style.display = "none";
		document.getElementById(image).src = '../templates/i/li_right.gif';
	}
}


function movePageImage(strPage, strFolderID,stat)
{
	loadPage('../templates/include/gallery.asp','stat='+stat+'&folderID=' + strFolderID + '&page=' + strPage,'content');
}
function submitGuestbook(isMember)
{
	
	var strURL = "../templates/action/addguestbook.asp";
	var queryString = "";
	//alert(strURL);
	//alert(queryString);
	if (isMember == "0")
	{
		document.formGuestbook.txtname.value=document.formGuestbook.txtname.value.trim();
		document.formGuestbook.txtemail.value=document.formGuestbook.txtemail.value.trim();
		document.formGuestbook.txtcomment.value=document.formGuestbook.txtcomment.value.trim();
		
		//first name receiver	
		if (document.formGuestbook.txtname.value == "name"){
			alert("Please Fill Out Your Name!");
			document.formGuestbook.txtname.focus();
			return false;
		}
		if (document.formGuestbook.txtname.value == ""){
			alert("Please Fill Out Your Name!");
			document.formGuestbook.txtname.focus();
			return false;
		}
		if (document.formGuestbook.txtname.value != "" && !checktags(document.formGuestbook.txtname.value)){
			alert("Your Name Should Not Has script/html tags!");
			document.formGuestbook.txtname.focus();
			return false;
		}	
		if ((document.formGuestbook.txtname.value == document.formGuestbook.txtemail.value) && document.formGuestbook.txtname.value != '') {
			alert("Your Name Should Not Contains Email Address!");
			document.formGuestbook.txtname.focus();
			return false;
		}
		if (document.formGuestbook.txtname.value != "" && !checkname(document.formGuestbook.txtname.value)) {
			alert("Your Name Should Not Contains Web Address!");
			document.formGuestbook.txtname.focus();
			return false;
		}
	
		//email receiver
		if (document.formGuestbook.txtemail.value == "email") {
			alert("Please Fill Out Your Email!");
			document.formGuestbook.txtemail.focus();
			return false;
		}	
		if (document.formGuestbook.txtemail.value == "") {
			alert("Please Fill Out Your Email!");
			document.formGuestbook.txtemail.focus();
			return false;
		}	
		if (document.formGuestbook.txtemail.value != "" && !checkemail(document.formGuestbook.txtemail.value)){
			alert("Email Is Not Valid");
			document.formGuestbook.txtemail.focus();
			return false;
		}	
		if (document.formGuestbook.txtemail.value != "" && !checktags(document.formGuestbook.txtemail.value)){
			alert("Email Should Not Has script/html tags!");
			document.formGuestbook.txtemail.focus();
			return false;
		}	 		 
		queryString += "txtname=" + escape(document.formGuestbook.txtname.value) +
		"&txtemail=" + escape(document.formGuestbook.txtemail.value);						 
	}
	else
	{
		queryString += "txtname=" + escape(document.formGuestbook.txtname.value) +
		"&txtemail=" + escape(document.formGuestbook.txtemail.value);						 
	}
	//comment	
	if (document.formGuestbook.txtcomment.value == ""){
		alert("Please Fill Out Your Message!");
		document.formGuestbook.txtcomment.focus();
		return false;
	}
	if (document.formGuestbook.txtcomment.value == "add a comment.."){
		alert("Please Fill Out Your Message!");
		document.formGuestbook.txtcomment.focus();
		return false;
	}
	if (document.formGuestbook.txtcomment.value != "" && !checktags7(document.formGuestbook.txtcomment.value)){
		alert("Message Should Not Has script/html tags!");
		document.formGuestbook.txtcomment.focus();
		return false;
	}
	queryString += "&txtcomment=" + escape(document.formGuestbook.txtcomment.value); 
	queryString += "&isOwner=" + isMember;
	queryString += "&action=submit";
	loadPage(strURL, queryString, 'divNotification','if(document.getElementById("divNotification").innerHTML.length<34) loadPage("../templates/include/gbcomment.asp","stat=1","gbComment");loadPage("../templates/include/gbcomment.asp","stat=0","gbCommentU");document.formGuestbook.txtcomment.value="add a comment.."');
}

function submitGuestbook2(isMember)
{
	
	var strURL = "../templates/action/addguestbook2.asp";
	var queryString = "";
	//alert(strURL);
	//alert(queryString);
	if (isMember == "0")
	{
		document.formGuestbook.txtname.value=document.formGuestbook.txtname.value.trim();
		document.formGuestbook.txtemail.value=document.formGuestbook.txtemail.value.trim();
		document.formGuestbook.txtcomment.value=document.formGuestbook.txtcomment.value.trim();
		
		//first name receiver	
		if (document.formGuestbook.txtname.value == "name"){
			alert("Please Fill Out Your Name!");
			document.formGuestbook.txtname.focus();
			return false;
		}
		if (document.formGuestbook.txtname.value == ""){
			alert("Please Fill Out Your Name!");
			document.formGuestbook.txtname.focus();
			return false;
		}
		if (document.formGuestbook.txtname.value != "" && !checktags(document.formGuestbook.txtname.value)){
			alert("Your Name Should Not Has script/html tags!");
			document.formGuestbook.txtname.focus();
			return false;
		}	
		if ((document.formGuestbook.txtname.value == document.formGuestbook.txtemail.value) && document.formGuestbook.txtname.value != '') {
			alert("Your Name Should Not Contains Email Address!");
			document.formGuestbook.txtname.focus();
			return false;
		}
		if (document.formGuestbook.txtname.value != "" && !checkname(document.formGuestbook.txtname.value)) {
			alert("Your Name Should Not Contains Web Address!");
			document.formGuestbook.txtname.focus();
			return false;
		}
	
		//email receiver
		if (document.formGuestbook.txtemail.value == "email") {
			alert("Please Fill Out Your Email!");
			document.formGuestbook.txtemail.focus();
			return false;
		}	
		if (document.formGuestbook.txtemail.value == "") {
			alert("Please Fill Out Your Email!");
			document.formGuestbook.txtemail.focus();
			return false;
		}	
		if (document.formGuestbook.txtemail.value != "" && !checkemail(document.formGuestbook.txtemail.value)){
			alert("Email Is Not Valid");
			document.formGuestbook.txtemail.focus();
			return false;
		}	
		if (document.formGuestbook.txtemail.value != "" && !checktags(document.formGuestbook.txtemail.value)){
			alert("Email Should Not Has script/html tags!");
			document.formGuestbook.txtemail.focus();
			return false;
		}	 		 
		queryString += "txtname=" + escape(document.formGuestbook.txtname.value) +
		"&txtemail=" + escape(document.formGuestbook.txtemail.value);						 
	}
	else
	{
		queryString += "txtname=" + escape(document.formGuestbook.txtname.value) +
		"&txtemail=" + escape(document.formGuestbook.txtemail.value);						 
	}
	//comment	
	if (document.formGuestbook.txtcomment.value == ""){
		alert("Please Fill Out Your Message!");
		document.formGuestbook.txtcomment.focus();
		return false;
	}
	if (document.formGuestbook.txtcomment.value == "add a comment.."){
		alert("Please Fill Out Your Message!");
		document.formGuestbook.txtcomment.focus();
		return false;
	}
	if (document.formGuestbook.txtcomment.value != "" && !checktags7(document.formGuestbook.txtcomment.value)){
		alert("Message Should Not Has script/html tags!");
		document.formGuestbook.txtcomment.focus();
		return false;
	}
	queryString += "&txtcomment=" + escape(document.formGuestbook.txtcomment.value); 
	queryString += "&isOwner=" + isMember;
	queryString += "&action=submit";
	loadPage(strURL, queryString, 'divNotification','if(document.getElementById("divNotification").innerHTML.length<34) loadPage("../templates/include/gbcomment2.asp","stat=1","gbComment");loadPage("../templates/include/gbcomment2.asp","stat=0","gbCommentU");document.formGuestbook.txtcomment.value="add a comment.."');
}

function submitComment(isMember, articleID)
{	
	var queryString = "";
	if (isMember == "0")
	{
		document.formGuestbook.txtname.value=document.formGuestbook.txtname.value.trim();
		document.formGuestbook.txtemail.value=document.formGuestbook.txtemail.value.trim();
		document.formGuestbook.txtcomment.value=document.formGuestbook.txtcomment.value.trim();
		
		//first name receiver
		if (document.formGuestbook.txtname.value == "name"){
			alert("Please Fill Out Your Name!");
			document.formGuestbook.txtname.focus();
			return false;
		}
		if (document.formGuestbook.txtname.value == ""){
			alert("Please Fill Out Your Name!");
			document.formGuestbook.txtname.focus();
			return false;
		}
		if (document.formGuestbook.txtname.value != "" && !checktags(document.formGuestbook.txtname.value)){
			alert("Your Name Should Not Has script/html tags!");
			document.formGuestbook.txtname.focus();
			return false;
		}	
		if ((document.formGuestbook.txtname.value == document.formGuestbook.txtemail.value) && document.formGuestbook.txtname.value != '') {
			alert("Your Name Should Not Contains Email Address!");
			document.formGuestbook.txtname.focus();
			return false;
		}	
		if (document.formGuestbook.txtname.value != "" && !checkname(document.formGuestbook.txtname.value)) {
			alert("Your Name Should Not Contains Web Address!");
			document.formGuestbook.txtname.focus();
			return false;
		}
	
		//email receiver
		if (document.formGuestbook.txtemail.value == "email") {
			alert("Please Fill Out Your Email!");
			document.formGuestbook.txtemail.focus();
			return false;
		}	
		if (document.formGuestbook.txtemail.value == "") {
			alert("Please Fill Out Your Email!");
			document.formGuestbook.txtemail.focus();
			return false;
		}	
		if (document.formGuestbook.txtemail.value != "" && !checkemail(document.formGuestbook.txtemail.value)){
			alert("Email Is Not Valid");
			document.formGuestbook.txtemail.focus();
			return false;
		}	
		if (document.formGuestbook.txtemail.value != "" && !checktags(document.formGuestbook.txtemail.value)){
			alert("Email Should Not Has script/html tags!");
			document.formGuestbook.txtemail.focus();
			return false;
		}	 		 
		queryString += "txtname=" + escape(document.formGuestbook.txtname.value) +
		"&txtemail=" + escape(document.formGuestbook.txtemail.value);						 
	}
	else
	{
		queryString += "txtname=" + escape(document.formGuestbook.txtname.value) +
		"&txtemail=" + escape(document.formGuestbook.txtemail.value);						 
	}
	//comment	
	if (document.formGuestbook.txtcomment.value == ""){
		alert("Please Fill Out Your Message!");
		document.formGuestbook.txtcomment.focus();
		return false;
	}
	if (document.formGuestbook.txtcomment.value == "add a comment.."){
		alert("Please Fill Out Your Message!");
		document.formGuestbook.txtcomment.focus();
		return false;
	}
	if (document.formGuestbook.txtcomment.value != "" && !checktags7(document.formGuestbook.txtcomment.value)){
		alert("Message Should Not Has script/html tags!");
		document.formGuestbook.txtcomment.focus();
		return false;
	}
	var strURL = "../templates/action/addcomment.asp";
	queryString += "&txtcomment=" + escape(document.formGuestbook.txtcomment.value); 
	queryString += "&action=submit";
	queryString += "&isOwner=" + isMember;	
	queryString += "&articleID=" + articleID;
	loadPage(strURL, queryString, 'divNotification','if(document.getElementById("divNotification").innerHTML.length<34){loadPage("../templates/ajax/getncomment.asp","articleid='+articleID+'","nComment");loadPage("../templates/include/blogcomment.asp","stat=1&articleid='+articleID+'","blogComment1");loadPage("../templates/include/blogcomment.asp","stat=0&articleid='+articleID+'","blogComment0")}document.formGuestbook.txtcomment.value="add a comment.."');
}

function submitImageComment(isMember, articleID)
{	
	var queryString = "";
	if (isMember == "0")
	{
		document.formGuestbook.txtname.value=document.formGuestbook.txtname.value.trim();
		document.formGuestbook.txtemail.value=document.formGuestbook.txtemail.value.trim();
		document.formGuestbook.txtcomment.value=document.formGuestbook.txtcomment.value.trim();
		
		//first name receiver
		if (document.formGuestbook.txtname.value == "name"){
			alert("Please Fill Out Your Name!");
			document.formGuestbook.txtname.focus();
			return false;
		}
		if (document.formGuestbook.txtname.value == ""){
			alert("Please Fill Out Your Name!");
			document.formGuestbook.txtname.focus();
			return false;
		}
		if (document.formGuestbook.txtname.value != "" && !checktags(document.formGuestbook.txtname.value)){
			alert("Your Name Should Not Has script/html tags!");
			document.formGuestbook.txtname.focus();
			return false;
		}	
		if ((document.formGuestbook.txtname.value == document.formGuestbook.txtemail.value) && document.formGuestbook.txtname.value != '') {
			alert("Your Name Should Not Contains Email Address!");
			document.formGuestbook.txtname.focus();
			return false;
		}	
		if (document.formGuestbook.txtname.value != "" && !checkname(document.formGuestbook.txtname.value)) {
			alert("Your Name Should Not Contains Web Address!");
			document.formGuestbook.txtname.focus();
			return false;
		}
	
		//email receiver
		if (document.formGuestbook.txtemail.value == "email") {
			alert("Please Fill Out Your Email!");
			document.formGuestbook.txtemail.focus();
			return false;
		}	
		if (document.formGuestbook.txtemail.value == "") {
			alert("Please Fill Out Your Email!");
			document.formGuestbook.txtemail.focus();
			return false;
		}	
		if (document.formGuestbook.txtemail.value != "" && !checkemail(document.formGuestbook.txtemail.value)){
			alert("Email Is Not Valid");
			document.formGuestbook.txtemail.focus();
			return false;
		}	
		if (document.formGuestbook.txtemail.value != "" && !checktags(document.formGuestbook.txtemail.value)){
			alert("Email Should Not Has script/html tags!");
			document.formGuestbook.txtemail.focus();
			return false;
		}	 		 
		queryString += "txtname=" + escape(document.formGuestbook.txtname.value) +
		"&txtemail=" + escape(document.formGuestbook.txtemail.value);						 
	}
	else
	{
		queryString += "txtname=" + escape(document.formGuestbook.txtname.value) +
		"&txtemail=" + escape(document.formGuestbook.txtemail.value);						 
	}
	//comment	
	if (document.formGuestbook.txtcomment.value == ""){
		alert("Please Fill Out Your Message!");
		document.formGuestbook.txtcomment.focus();
		return false;
	}
	if (document.formGuestbook.txtcomment.value == "add a comment.."){
		alert("Please Fill Out Your Message!");
		document.formGuestbook.txtcomment.focus();
		return false;
	}
	if (document.formGuestbook.txtcomment.value != "" && !checktags7(document.formGuestbook.txtcomment.value)){
		alert("Message Should Not Has script/html tags!");
		document.formGuestbook.txtcomment.focus();
		return false;
	}
	var strURL = "../templates/action/addimagecomment.asp";
	queryString += "&txtcomment=" + escape(document.formGuestbook.txtcomment.value); 
	queryString += "&action=submit";
	queryString += "&isOwner=" + isMember;	
	queryString += "&articleID=" + articleID;
	
	loadPage(strURL, queryString, 'divNotification','if(document.getElementById("divNotification").innerHTML.length<34){loadPage("../templates/ajax/getimagencomment.asp","imageid='+articleID+'","nComment");loadPage("../templates/include/imagecomment.asp","stat=1&imageid='+articleID+'","imageComment1");loadPage("../templates/include/imagecomment.asp","stat=0&imageid='+articleID+'","imageComment0")}document.formGuestbook.txtcomment.value="add a comment.."');
}


function clearGuestbookComment()
{
	if (document.formGuestbook.txtcomment.value == "add a comment..")
	{
		document.formGuestbook.txtcomment.value = "";
	}
}

function refreshGuestbookComment()
{
	if (document.formGuestbook.txtcomment.value == "")
	{
		document.formGuestbook.txtcomment.value = "add a comment..";
	}
}

function clearGuestbookName()
{
	if (document.formGuestbook.txtname.value == "name")
	{
		document.formGuestbook.txtname.value = "";
	}
}

function refreshGuestbookName()
{
	if (document.formGuestbook.txtname.value == "")
	{
		document.formGuestbook.txtname.value = "name";
	}
}

function clearGuestbookEmail()
{
	if (document.formGuestbook.txtemail.value == "email")
	{
		document.formGuestbook.txtemail.value = "";
	}
}

function refreshGuestbookEmail()
{
	if (document.formGuestbook.txtemail.value == "")
	{
		document.formGuestbook.txtemail.value = "email";
	}
}

function checkname(name) {
    if (name.indexOf("wedsite")!=-1 || name.indexOf("website")!=-1 || name.indexOf(".info")!=-1 || name.indexOf(".biz")!=-1 || name.indexOf(".or")!=-1 || name.indexOf(".net")!=-1 || name.indexOf(".co")!=-1 || name.indexOf("www")!=-1 || name.indexOf("@")!=-1 || name.indexOf("neowed")!=-1 || name.indexOf("menaravisi")!=-1 || name.indexOf("weddingku")!=-1 || name.indexOf("test")!=-1 || name.indexOf("hjkl")!=-1 || name.indexOf("yuio")!=-1 || name.indexOf("zxcv")!=-1 || name.indexOf("asdf")!=-1 || name.indexOf("qwer")!=-1)
		return false;
	else
		return true;
}

function checkemail(email) {
    if (email.length < 11 || email.indexOf("@")==-1 || email.indexOf(".")==-1 || email.indexOf("!")!=-1 || email.indexOf("..")!=-1 || email.indexOf(".")==0 || email.indexOf(".")==email.length|| email.indexOf("neowed")!=-1 || email.indexOf("menaravisi")!=-1 || email.indexOf("weddingku")!=-1 || email.indexOf("test")!=-1 || email.indexOf("hjkl")!=-1 || email.indexOf("yuio")!=-1 || email.indexOf("zxcv")!=-1 || email.indexOf("asdf")!=-1 || email.indexOf("qwer")!=-1)
		return false;
    else {
		var pos;
		pos = email.indexOf("@");
		var mailbox=email.substring(0,pos);
		var domainname=email.substring(pos+1,email.length);
		var mailboxlast=mailbox.substring(mailbox.length-1,mailbox.length);
		var domainfirst=domainname.substring(0,1);
		var lastdigit=email.substring(email.length-1,email.length);
		var firstdigit=email.substring(0,1)
		if (mailbox.indexOf("-")==-1 && domainname.indexOf("_")==-1 && domainname.indexOf("@")==-1 && lastdigit.indexOf(".")==-1 && lastdigit.indexOf("-")==-1 && firstdigit.indexOf(".")==-1 && firstdigit.indexOf("_")==-1 && mailboxlast.indexOf(".")==-1 && mailboxlast.indexOf("_")==-1 && domainfirst.indexOf(".")==-1 && domainfirst.indexOf("-")==-1)
			return true;
		else
			return false;
    }
}

function checktags7(chkstr) {
	if (chkstr.indexOf("i>")==-1 && chkstr.indexOf("b>")==-1 && chkstr.indexOf("p>")==-1 && chkstr.indexOf("h1>")==-1 && chkstr.indexOf("h2>")==-1 && chkstr.indexOf("h3>")==-1 && chkstr.indexOf("h4>")==-1 && chkstr.indexOf("h5>")==-1 && chkstr.indexOf("h6>")==-1 && chkstr.indexOf("body>")==-1 && chkstr.indexOf("html>")==-1 && chkstr.indexOf("br>")==-1 && chkstr.indexOf("hr>")==-1 && chkstr.indexOf("font>")==-1 && chkstr.indexOf("script>")==-1 && chkstr.indexOf("-->>")==-1 && chkstr.indexOf("<\!--")==-1 && chkstr.indexOf("form>")==-1 && chkstr.indexOf("div>")==-1 && chkstr.indexOf("u>")==-1 && chkstr.indexOf("ol>")==-1 && chkstr.indexOf("ul>")==-1 && chkstr.indexOf("select>")==-1 && chkstr.indexOf("<input")==-1 && chkstr.indexOf("location.href")==-1 && chkstr.indexOf("response.redirect")==-1 && chkstr.indexOf("<%")==-1 && chkstr.indexOf("http")==-1 && chkstr.indexOf("ftp")==-1 && chkstr.indexOf(".js")==-1 && chkstr.indexOf("%>")==-1)
	{
		return true;
	}
	else
	{
		return false;
	}
}

function olderPost()
{
    var lastId=0;
    /*if(typeof document.formblog.lastid.length=='undefined'){
        lastId=document.formblog.lastid.value;
    }else{
        lastId=document.formblog.lastid[document.formblog.lastid.length-1].value;
    }*/
    lastId=document.getElementById("lastid").value;
    if (lastId=='' || lastId==0)
        alert('No older post');
    else
	{
        loadPage('../templates/include/blog.asp?lastid='+lastId,'','divBlogNext','document.getElementById(\'divBlogList\').innerHTML+=document.getElementById(\'divBlogNext\').innerHTML;document.getElementById(\'divBlogNext\').innerHTML=\'\'');
		var parent=document.getElementById("divBlogList");
		var child=document.getElementById("olderPost");
		parent.removeChild(child);
	}
}