﻿window.name='lno';

function makevisible(cur,which){
if (which==0)
cur.filters.alpha.opacity=100
else
cur.filters.alpha.opacity=60
}

function login(the_form)
{						
var username = the_form.username.value;
var passinput = the_form.passinput.value;
if ( (username=='')||(passinput=='') )
{
alert("Nhập đầy đủ thông tin yêu cầu");
the_form.username.focus();
the_form.passinput.focus();
return false;
}
}

function camnhan(the_form)
{						
var o_content = the_form.o_content.value;
if ( (o_content=='') )
{
alert("Insert Infomation");
the_form.o_content.focus();
return false;
}
if (o_content.length<20){
alert("Min Content 20 character");
the_form.o_content.focus();
return false;
}
if (o_content.length>400){
alert("Max content  400 character");
the_form.o_content.focus();
return false;
}
}

function contact(the_form)
{
var the_email    = the_form.email.value;
var the_name     = the_form.name.value;
var the_content  = the_form.content.value;
if ( (the_email=='')||(the_name=='')||(the_content=='') )
{
alert("Insert Infomation");
the_form.email.focus();
return false;
}
var the_at    = the_email.indexOf("@");
var the_dot   = the_email.indexOf(".");
var the_space = the_email.indexOf(" ");
if ( (the_at!=-1)&&(the_at!=0)&&(the_dot!=-1)&&(the_dot>the_at + 1)&&(the_dot<email.length-1)&&(the_space==-1) )
return true;
alert("Email not corect");
the_form.email.focus();
return false;
}

function reg(the_form)
{
var the_email    = the_form.email.value;
var the_name     = the_form.realname.value;
var the_password = the_form.password.value;
var the_verifypass = the_form.verifypass.value;
var the_regcode    = the_form.reg_code.value;
if ( (the_email=='')||(the_name=='')||(the_password=='')||(the_verifypass=='')||(the_regcode=='') )
{
alert("Insert Infomation");
the_form.email.focus();
return false;
}
var the_at    = the_email.indexOf("@");
var the_dot   = the_email.indexOf(".");
var the_space = the_email.indexOf(" ");
if ( (the_at!=-1)&&(the_at!=0)&&(the_dot!=-1)&&(the_dot>the_at + 1)&&(the_dot<the_email.length-1)&&(the_space==-1) )
return true;
alert("Email not corect");
the_form.email.focus();
return false;
}

function search(str){
if (str.value==''){
alert("Insert keyword");
str.focus;
return false;
}
return true;
}

function shout(str){
if (str.value==''){
alert("Insert content");
str.focus;
return false;
}
return true;
}

function diedlink(theURL){
if (confirm('You sure broken link?')) {
window.location.href=theURL;
}
else {
alert ('Cancel broken');
}
}

function openMeExt(vLink, vStatus, vResizeable, vScrollbars, vToolbar, vLocation, vFullscreen, vTitlebar, vCentered, vHeight, vWidth, vTop, vLeft, vID)
{
var sLink = (typeof(vLink.href) == 'undefined') ? vLink : vLink.href;

winDef = '';
winDef = winDef.concat('status=').concat((vStatus) ? 'yes' : 'no').concat(',');
winDef = winDef.concat('resizable=').concat((vResizeable) ? 'yes' : 'no').concat(',');
winDef = winDef.concat('scrollbars=').concat((vScrollbars) ? 'yes' : 'no').concat(',');
winDef = winDef.concat('toolbar=').concat((vToolbar) ? 'yes' : 'no').concat(',');
winDef = winDef.concat('location=').concat((vLocation) ? 'yes' : 'no').concat(',');
winDef = winDef.concat('fullscreen=').concat((vFullscreen) ? 'yes' : 'no').concat(',');
winDef = winDef.concat('titlebar=').concat((vTitlebar) ? 'yes' : 'no').concat(',');
winDef = winDef.concat('height=').concat(vHeight).concat(',');
winDef = winDef.concat('width=').concat(vWidth).concat(',');

if (vCentered)
{
winDef = winDef.concat('top=').concat((screen.height - vHeight)/2).concat(',');
winDef = winDef.concat('left=').concat((screen.width - vWidth)/2);
}
else
{
winDef = winDef.concat('top=').concat(vTop).concat(',');
winDef = winDef.concat('left=').concat(vLeft);
}

if (typeof(vID) == 'undefined')
{
vID = 0;
}
	
open(sLink, 'playlist', winDef);

if (typeof(vLink.href) != 'undefined')
{
return false;
}
}

function download(){
alert("Click right mouse, Select 'Save Target As..' to download");
return false;
}

function quatang(the_form)
{
var the_sendname = the_form.txtFromName.value;
var the_sendmail = the_form.txtFromEmail.value;
var the_toname = the_form.txtToName.value;
var the_tomail = the_form.txtToEmail.value;
var the_subject = the_form.txtSubject.value;
var the_message = the_form.txtMessage.value;
if ( (the_sendname=='')||(the_sendmail=='')||(the_toname=='')||(the_tomail=='')||(the_subject=='')||(the_message=='') )
{
alert("Insert infomation");
the_form.tomail.focus();
return false;
}
var the_at    = the_email.indexOf("@");
var the_dot   = the_email.indexOf(".");
var the_space = the_email.indexOf(" ");
if ( (the_at!=-1)&&(the_at!=0)&&(the_dot!=-1)&&(the_dot>the_at + 1)&&(the_dot<the_email.length-1)&&(the_space==-1) )
return true;
alert("Email not corect");
the_form.tomail.focus();
return false;
}

function change_stamp(){
var up_stamp = document.form1.stamp1.options[document.form1.stamp1.selectedIndex].value
if (up_stamp == "") { return }
document.form1.getstamp.src = "uploads/ecard/" + up_stamp + "";
document.form1.cardimg.value = up_stamp;
document.form1.stamp.value = up_stamp;
}

function changeFont(strFont){
divContent.style.fontFamily = strFont;
document.form1.cardfontname.value = strFont;
document.form1.hFontName.value = strFont;
}

function setContent(target){
var strContent = document.form1.txtMessage.value;			
while(strContent.search("\r\n") > 0)
{
strContent = strContent.replace("\r\n","<br>");
strContent = strContent.replace(" ","&nbsp;");
}
divContent.innerHTML = strContent;
}

function changeSize(){
var iSize = document.form1.cbFontSize.item(document.form1.cbFontSize.selectedIndex).value;
document.form1.cardfontsize.value = iSize;
divContent.style.fontSize = iSize;
}

function changeStyle(){
var iStyle = document.form1.cbFontStyle.item(document.form1.cbFontStyle.selectedIndex).value;
switch(parseInt(iStyle, 10))
{
case 1:
divContent.style.fontWeight  = 'normal';
divContent.style.fontStyle = 'normal';
document.form1.cardfontstyle.value = 'normal';
document.form1.cardfontweight.value = 'normal';
break;
case 2:
divContent.style.fontStyle = 'italic';
divContent.style.fontWeight = 'normal';
document.form1.cardfontstyle.value = 'italic';
document.form1.cardfontweight.value = 'normal';
break;
case 3:
divContent.style.fontWeight = 'bold';
divContent.style.fontStyle = 'normal';
document.form1.cardfontstyle.value = 'normal';
document.form1.cardfontweight.value = 'bold';
break;
case 4:
divContent.style.fontStyle = "italic";
divContent.style.fontWeight = "BOLD";
document.form1.cardfontstyle.value = 'italic';
document.form1.cardfontweight.value = 'BOLD';
break;
}
}

function bbcode(icon) {
document.feeling.o_content.value = document.feeling.o_content.value + icon;
}
