var mydate=new Date();
var year=mydate.getYear();
var LastUpdated = document.lastModified;
if (year < 1000)
year+=1900;
var day=mydate.getDay();
var month=mydate.getMonth();
var daym=mydate.getDate();
if (daym<10)
daym="0"+daym;
var dayarray=new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday");
var montharray=new Array("January","February","March","April","May","June","July","August","September","October","November","December");
var main_content;
main_content=dayarray[day]+", "+montharray[month]+" "+daym+", "+year;
function show_loading(idsome)
{
    document.getElementById(idsome).style.backgroundColor="#CB8B5B";
    document.getElementById(idsome).style.color="#ffffff";
    $('#overlay,#please_wait_id').show();
        return false;

}

$(document).ready(function(){
    $('.subholder').hover(function() {

            $('.actual_subholder').fadeIn(500);
            }, function() {
            $(this).removeClass('highlight');
            $('.actual_subholder').fadeOut(500);
            });
    
    anchor.init();
    

});
function topme(pos){
	$( 'html, body' ).animate( { scrollTop: pos }, 'slow' );
}
var highlightedid;
anchor = {
            init : function()  {
                    $("a.anchorLink").click(function () {
                            elementClick = $(this).attr("href");
                            $(highlightedid).removeClass('highlight');
                            destination = $(elementClick).offset().top;
                            destination-=10; highlightedid=elementClick;
                            $(highlightedid).addClass('highlight');

                            $("html:not(:animated),body:not(:animated)").animate({ scrollTop: destination}, 1000  );

                            return false;
                    })
                    $("a.anchorLinkDept").click(function () {
                            elementClick = $(this).attr("href");
                            $(highlightedid).removeClass('highlight');
                            destination = $(elementClick).offset().top;
                            destination-=73; highlightedid=elementClick;
                            $(highlightedid).addClass('highlight');

                            $("html:not(:animated),body:not(:animated)").animate({ scrollTop: destination}, 1000  );

                            return false;
                    })

            }
	}

function fire()
	{
	document.getElementById('frame_gall').style.visibility="visible";document.getElementById('mobile_details').style.background="#ffffff";
	}
function write_iframe_index(){
	$('#mainoverlay').fadeIn(200);
	$('#mobile_details').fadeIn();
	document.getElementById('mobile_details_inner').innerHTML='<div style="position:relative;top:5px;height:115px;margin-bottom:-90px;background:#ffffff;width:auto;padding-top:40px;padding-left:20px;padding-right:10px;" class="title15_blue">For Recieving Saiha News Updates on your Mobile, Please Sign-in to your Gmail Account and then verify your mobile number<br/><br/><br/><span style="font-size:14px;color:brown;font-weight:normal;">Alternatively You can subscribe to the Channel by sending an sms "ON DC_Saiha" to +919870807070 </span></div><iframe id="frame_gall" src="http://labs.google.co.in/smschannels/subscribe/DC_Saiha" frameborder="0" scrolling="no" style="visibility:hidden;overflow:hidden;width:100%;height:100%;" onload="javascript:fire();"/>';
	$('#mobile_details_inner').append('<div style="position:relative;bottom:0px;height:125px;margin-top:-159px;background:white;width:100%;"></div>');
}

 message = document.getElementById("fly").innerHTML; // $ = taking a new line
 distance = 60; // pixel(s)
 speed = 200; // milliseconds

var txt="",
	num=0,
	num4=0,
	flyofle="",
	flyofwi="",
	flyofto="",
	fly=document.getElementById("fly");
function stfly() {
	
	for(i=0;i != message.length;i++) {
		if(message.charAt(i) != "$")
			txt += "<span style='position:relative;visibility:hidden;' id='n"+i+"'>"+message.charAt(i)+"<\/span>";
		else
			txt += "<br>";
	}
	fly.innerHTML = txt;
	txt = "";
	flyofle = fly.offsetLeft;
	flyofwi = fly.offsetWidth;
	flyofto = fly.offsetTop;
	fly2b();
}

function fly2b() {
	if(num4 != message.length) {
		if(message.charAt(num4) != "$") {
			var then = document.getElementById("n" + num4);
			then.style.left = flyofle - then.offsetLeft + flyofwi / 2;
			then.style.top = flyofto - then.offsetTop + distance;
			fly3(then.id, parseInt(then.style.left), parseInt(then.style.left) / 5, parseInt(then.style.top), parseInt(then.style.top) / 5);
		}
		num4++;
		setTimeout("fly2b()", speed);
	}
}

function fly3(target,lef2,num2,top2,num3) {
	if((Math.floor(top2) != 0 && Math.floor(top2) != -1) || (Math.floor(lef2) != 0 && Math.floor(lef2) != -1)) {
		if(lef2 >= 0)
			lef2 -= num2;
		else
			lef2 += num2 * -1;
		if(Math.floor(lef2) != -1) {
			document.getElementById(target).style.visibility = "visible";
			document.getElementById(target).style.left = Math.floor(lef2);
		} else {
			document.getElementById(target).style.visibility = "visible";
			document.getElementById(target).style.left = Math.floor(lef2 + 1);
		}
		if(lef2 >= 0)
			top2 -= num3;
		else
			top2 += num3 * -1;
		if(Math.floor(top2) != -1)
			document.getElementById(target).style.top = Math.floor(top2);
		else
			document.getElementById(target).style.top = Math.floor(top2 + 1);
		setTimeout("fly3('"+target+"',"+lef2+","+num2+","+top2+","+num3+")",50);
	}
}
function replacedoc(filename,titlename)
{
	alert("Please wait while the file is loading ...");
	
	document.getElementById("emid").src=filename;
	document.getElementById("title_name").innnerHTML=titlename;
}

