//Set tab in Library
function feedbackform(){
    	window.open("http://www.diaspark.com/website_enquiries/FeedBackForm.aspx", "Diaspark", "scrollbars=no,menubar=no,resizable=no,width=517,height=600");
		                 }
function setTab(index)
{
    var allLinks= $('ul#tnb').children('li').children('a');
    allLinks.removeClass('selected');
    $(allLinks[index-1]).addClass('selected');
} 
/*ends*/

function showTab(obj,divID)
{
	$('#'+divID).parent().children().hide();
	$(obj).parent().children().removeClass();
	$('#'+divID).slideDown();
	$(obj).addClass('selected');	
}

function slideDown(divID)
{
	jQuery('div#'+divID).slideDown();
}
function slideUp(divID)
{
	jQuery('div#'+divID).slideUp();
}
function fadeIn(divID)
{
	jQuery('div#'+divID).fadeIn('fast');
}
function fadeOut(divID)
{
	jQuery('div#'+divID).fadeOut('fast');
}
function toggleDiv(divID)
{
	if(document.getElementById(divID).style.display=='none')
	jQuery('div#'+divID).fadeIn();
	else
	jQuery('div#'+divID).fadeOut();
}

function toggleDivLink(sender,divID)
{
	if(document.getElementById(divID).style.display=='none')
	{
		jQuery('div#'+divID).slideDown();
		sender.getElementsByTagName('img')[0].src='../images/TabL.png';
	}
	else
	{
		jQuery('div#'+divID).slideUp();
		sender.getElementsByTagName('img')[0].src='../images/TabR.png';
	}
}
function onlyShow(divId)
{
	document.getElementById(divId).style.display="";
}
function onlyHide(divId)
{
	document.getElementById(divId).style.display="none";
}


//Image Slider Home JS
var slideContainerID;
var linkContainerID;
var slideTimer;
var slideIndex=-1;
var pagerID;
var numSlides;
function showSlide()
{
	if(slideTimer)
	clearInterval(slideTimer);
	slideIndex++;
	
	var allSlides=$('#'+slideContainerID).children();
	numSlides=allSlides.length;
	allSlides.hide();
	if(slideIndex>numSlides-1)
	slideIndex=0;
	$(allSlides[slideIndex]).fadeIn('slow');
	if(document.getElementById(linkContainerID))
	{
		var allLinks=document.getElementById(linkContainerID).getElementsByTagName('a');
		for(var loop=0;loop<allLinks.length;loop++)
		$(allLinks[loop]).removeClass();
		$(allLinks[slideIndex]).addClass('selected');
	}
	if(document.getElementById(pagerID))
	{
		$('#'+pagerID).html((slideIndex+1)+'/'+numSlides);
	}
	slideTimer=setTimeout(showSlide,8000);
}

function gotoAndPlay(slideToPlay)
{
	slideIndex=slideToPlay-1;
	showSlide();
}

function nextSlide()
{
	showSlide();
}
function prevSlide()
{
	slideIndex=slideIndex-2;
	if(slideIndex<-1)
	slideIndex=numSlides-2;
	showSlide();
}

//Dropdown Starts
var menu=function(){
	var t=15,z=50,s=6,a;
	function dd(n){this.n=n; this.h=[]; this.c=[]}
	dd.prototype.init=function(p,c){
		a=c; var w=document.getElementById(p), s=w.getElementsByTagName('ul'), l=s.length, i=0;
		for(i;i<l;i++){
			var h=s[i].parentNode; this.h[i]=h; this.c[i]=s[i];
			h.onmouseover=new Function(this.n+'.st('+i+',true)');
			h.onmouseout=new Function(this.n+'.st('+i+')');
		}
	}
	dd.prototype.st=function(x,f){
		var c=this.c[x], h=this.h[x], p=h.getElementsByTagName('a')[0];
		clearInterval(c.t); c.style.overflow='hidden';
		if(f){
			p.className+=' '+a;
			if(!c.mh){c.style.display='block'; c.style.height=''; c.mh=c.offsetHeight; c.style.height=0}
			if(c.mh==c.offsetHeight){c.style.overflow='visible'}
			else{c.style.zIndex=z; z++; c.t=setInterval(function(){sl(c,1)},t)}
		}else{p.className=p.className.replace(a,''); c.t=setInterval(function(){sl(c,-1)},t)}
	}
	function sl(c,f){
		var h=c.offsetHeight;
		if((h<=0&&f!=1)||(h>=c.mh&&f==1)){
			if(f==1){c.style.filter=''; c.style.opacity=1; c.style.overflow='visible'}
			clearInterval(c.t); return
		}
		var d=(f==1)?Math.ceil((c.mh-h)/s):Math.ceil(h/s), o=h/c.mh;
		c.style.opacity=o; c.style.filter='alpha(opacity='+(o*100)+')';
		c.style.height=h+(d*f)+'px'
	}
	return{dd:dd}
}();


   function myFocus(element) {
     if (element.value == element.defaultValue) {
       element.value = '';
     }
   }
   function myBlur(element) {
     if (element.value == '') {
       element.value = element.defaultValue;
     }
   }

//Scroll News Home Page
//index pages news
var pausecontent=new Array()

pausecontent[0]='<p><a  class="feat-prog" href="./news/featured_program.html">SpeechTek 2011   </a></p><span><b> Aug 8 - 10, 2011, NY, USA </b></span>'
pausecontent[1]='<p><a  class="feat-prog" href="./news/featured_program.html">Interop 2011</a></p><span><b>Oct 3 - 7, 2011, NY, USA </b></span>' 
pausecontent[2]='<p><a  class="feat-prog" href="./news/featured_program.html">Content & Communications World   </a></p><span><b> Oct 12 - 13, 2011, NY, USA</b></span>'


//index pages what's our client say
var whatourclient=new Array()
whatourclient[0]='<p><a href="http://www.diaspark.com/news/client_testimonials.html#11" target="_blank"> I wanted to take this opportunity to offer my most sincere appreciation for the work Diaspark has done.</a></p>' 
whatourclient[1]='<p><a href="http://www.diaspark.com/news/client_testimonials.html#12" target="_blank">The overall experience of working with Diaspark was excellent.</a></p>' 
whatourclient[2]='<p><a href="http://www.diaspark.com/news/client_testimonials.html#13" target="_blank">The feedback so far has been good.</a></p>' 
whatourclient[3]='<p><a href="http://www.diaspark.com/news/client_testimonials.html#14" target="_blank">Thanks Team for doing a great job on releasing the Billing SDK builds.</a></p>' 
whatourclient[4]='<p><a href="http://www.diaspark.com/news/client_testimonials.html#15" target="_blank"> Diasparks team of professionals</a></p>' 
 

//resources pages news
var pausecontent_new1=new Array()
pausecontent_new1[0]='<p><a href="http://www.diaspark.com/news/index.htm#2feb12">Diaspark at TCEA 2012 convention & exhibition</a></p>'
pausecontent_new1[1]='<p><a href="http://www.diaspark.com/news/index.htm#24jan12">Diasparks Catalog2go A Catalog and Order Entry App on iPad wins at 2nd India Digital Awards organized by IAMAI</a></p>'

pausecontent_new1[2]='<p><a href="http://www.diaspark.com/news/index.htm#10jan12">Diasparks Catalog2go – Catalog and Order Entry App on iPad featured as one of the top 5 Mobile Enterprise Products</a></p>'
pausecontent_new1[3]='<p><a href="http://www.diaspark.com/news/index.htm#30dec11">Diaspark exhibiting at JA NY Winter Show, Javits Convention Centre New York</a></p>'
pausecontent_new1[4]='<p><a href="http://www.diaspark.com/news/index.htm#26de2011">Holiday Season The perfect time to gift your children Learnember App</a></p>'
pausecontent_new1[5]='<p><a href="http://www.diaspark.com/news/index.htm#11nov11"> GPS based Coupons App Gopons on iPhone Platform hits iTunes</a></p>'








//resources pages news
var newuploads=new Array()
newuploads[0]='<p><a href="http://www.diaspark.com/news/whitepapers.aspx">Paradigm Shift in the Software Testing Outsourcing trend - a New road Ahead </a></p>'
newuploads[1]='<p><a href="http://www.diaspark.com/news/casestudy.aspx">Diaspark helped a leading Home Healthcare Software provider Re-engineer their Home Health Agency Management System </a></p>'
newuploads[2]='<p><a href="http://www.diaspark.com/news/brochures.aspx">Order Entry is a breeze and selling is easier with Diaspark Catalog2go app on iPad </a></p>'




function pausescroller(content, divId, divClass, delay){
this.content=content //message array content
this.tickerid=divId //ID of ticker div to display information
this.delay=delay //Delay between msg change, in miliseconds.
this.mouseoverBol=0 //Boolean to indicate whether mouse is currently over scroller (and pause it if it is)
this.hiddendivpointer=1 //index of message array for hidden div
document.write('<div id="'+divId+'" class="'+divClass+'" style="position: relative; overflow: hidden"><div class="innerDiv" style="position: absolute; width: 100%; height: 100%;" id="'+divId+'1">'+content[0]+'</div><div class="innerDiv" style="position: absolute; width: 100%; height: 100%; visibility: hidden" id="'+divId+'2">'+content[1]+'</div></div>')
var scrollerinstance=this
if (window.addEventListener) //run onload in DOM2 browsers
window.addEventListener("load", function(){scrollerinstance.initialize()}, false)
else if (window.attachEvent) //run onload in IE5.5+
window.attachEvent("onload", function(){scrollerinstance.initialize()})
else if (document.getElementById) //if legacy DOM browsers, just start scroller after 0.5 sec
setTimeout(function(){scrollerinstance.initialize()}, 500)
}

// -------------------------------------------------------------------
// initialize()- Initialize scroller method.
// -Get div objects, set initial positions, start up down animation
// -------------------------------------------------------------------

pausescroller.prototype.initialize=function(){
this.tickerdiv=document.getElementById(this.tickerid)
this.visiblediv=document.getElementById(this.tickerid+"1")
this.hiddendiv=this.hiddendiv=document.getElementById(this.tickerid+"2")
this.visibledivtop=parseInt(pausescroller.getCSSpadding(this.tickerdiv))
//set width of inner DIVs to outer DIV's width minus padding (padding assumed to be top padding x 2)
this.visiblediv.style.width=this.hiddendiv.style.width=this.tickerdiv.offsetWidth-(this.visibledivtop*2)+"px"
this.getinline(this.visiblediv, this.hiddendiv)
this.hiddendiv.style.visibility="visible"
var scrollerinstance=this
document.getElementById(this.tickerid).onmouseover=function(){scrollerinstance.mouseoverBol=1}
document.getElementById(this.tickerid).onmouseout=function(){scrollerinstance.mouseoverBol=0}
if (window.attachEvent) //Clean up loose references in IE
window.attachEvent("onunload", function(){scrollerinstance.tickerdiv.onmouseover=scrollerinstance.tickerdiv.onmouseout=null})
setTimeout(function(){scrollerinstance.animateup()}, this.delay)
}


// -------------------------------------------------------------------
// animateup()- Move the two inner divs of the scroller up and in sync
// -------------------------------------------------------------------

pausescroller.prototype.animateup=function(){
var scrollerinstance=this
if (parseInt(this.hiddendiv.style.top)>(this.visibledivtop+5)){
this.visiblediv.style.top=parseInt(this.visiblediv.style.top)-5+"px"
this.hiddendiv.style.top=parseInt(this.hiddendiv.style.top)-5+"px"
setTimeout(function(){scrollerinstance.animateup()}, 70)
}
else{
this.getinline(this.hiddendiv, this.visiblediv)
this.swapdivs()
setTimeout(function(){scrollerinstance.setmessage()}, this.delay)
}
}

// -------------------------------------------------------------------
// swapdivs()- Swap between which is the visible and which is the hidden div
// -------------------------------------------------------------------

pausescroller.prototype.swapdivs=function(){
var tempcontainer=this.visiblediv
this.visiblediv=this.hiddendiv
this.hiddendiv=tempcontainer
}

pausescroller.prototype.getinline=function(div1, div2){
div1.style.top=this.visibledivtop+"px"
div2.style.top=Math.max(div1.parentNode.offsetHeight, div1.offsetHeight)+"px"
}

// -------------------------------------------------------------------
// setmessage()- Populate the hidden div with the next message before it's visible
// -------------------------------------------------------------------

pausescroller.prototype.setmessage=function(){
var scrollerinstance=this
if (this.mouseoverBol==1) //if mouse is currently over scoller, do nothing (pause it)
setTimeout(function(){scrollerinstance.setmessage()}, 100)
else{
var i=this.hiddendivpointer
var ceiling=this.content.length
this.hiddendivpointer=(i+1>ceiling-1)? 0 : i+1
this.hiddendiv.innerHTML=this.content[this.hiddendivpointer]
this.animateup()
}
}

pausescroller.getCSSpadding=function(tickerobj){ //get CSS padding value, if any
if (tickerobj.currentStyle)
return tickerobj.currentStyle["paddingTop"]
else if (window.getComputedStyle) //if DOM2
return window.getComputedStyle(tickerobj, "").getPropertyValue("padding-top")
else
return 0
}


























var restarea=6 //1) width of the "neutral" area in the center of the gallery in px
var maxspeed=7 //2) top scroll speed in pixels. Script auto creates a range from 0 to top speed.
var endofgallerymsg="<span style='font-size: 11px'>End of Gallery</span>" //3) message to show at end of gallery. Enter "" to disable message.

function enlargeimage(path, optWidth, optHeight){ //function to enlarge image. Change as desired.
var actualWidth=typeof optWidth!="undefined" ? optWidth : "200px" //set 600px to default width
var actualHeight=typeof optHeight!="undefined" ? optHeight : "500px" //set 500px to  default height
var winattributes="width="+actualWidth+",height="+actualHeight+",resizable=yes"
window.open(path,"", winattributes)
}

////NO NEED TO EDIT BELOW THIS LINE////////////

var iedom=document.all||document.getElementById
var scrollspeed=0
var movestate=""

if (iedom)
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-10000;"></span>')

var actualwidth=''
var cross_scroll, ns_scroll
var loadedyes=0

function ietruebody(){
return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

function creatediv(){
statusdiv=document.createElement("div")
statusdiv.setAttribute("id","statusdiv")
document.body.appendChild(statusdiv)
statusdiv=document.getElementById("statusdiv")
statusdiv.innerHTML=endofgallerymsg
}

function positiondiv(){
menuheight=parseInt(crossmain.offsetHeight)
mainobjoffsetH=getposOffset(crossmain, "top")
statusdiv.style.left=mainobjoffset+(menuwidth/2)-(statusdiv.offsetWidth/2)+"px"
statusdiv.style.top=menuheight+mainobjoffsetH+"px"
}

function showhidediv(what){
if (endofgallerymsg!="")
statusdiv.style.visibility=what
}

function getposOffset(what, offsettype){
var totaloffset=(offsettype=="left")? what.offsetLeft: what.offsetTop;
var parentEl=what.offsetParent;
while (parentEl!=null){
totaloffset=(offsettype=="left")? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop;
parentEl=parentEl.offsetParent;
}
return totaloffset;
}


function moveleft(){
if (loadedyes){
movestate="left"
if (iedom&&parseInt(cross_scroll.style.left)>(menuwidth-actualwidth)){
cross_scroll.style.left=parseInt(cross_scroll.style.left)-scrollspeed+"px"
showhidediv("hidden")
}
else
showhidediv("visible")
}
lefttime=setTimeout("moveleft()",10)
}

function moveright(){
if (loadedyes){
movestate="right"
if (iedom&&parseInt(cross_scroll.style.left)<0){
cross_scroll.style.left=parseInt(cross_scroll.style.left)+scrollspeed+"px"
showhidediv("hidden")
}
else
showhidediv("visible")
}
righttime=setTimeout("moveright()",10)
}

function motionengine(e){
var dsocx=(window.pageXOffset)? pageXOffset: ietruebody().scrollLeft;
var dsocy=(window.pageYOffset)? pageYOffset : ietruebody().scrollTop;
var curposy=window.event? event.clientX : e.clientX? e.clientX: ""
curposy-=mainobjoffset-dsocx
var leftbound=(menuwidth-restarea)/2
var rightbound=(menuwidth+restarea)/2
if (curposy>rightbound){
scrollspeed=(curposy-rightbound)/((menuwidth-restarea)/2) * maxspeed
if (window.righttime) clearTimeout(righttime)
if (movestate!="left") moveleft()
}
else if (curposy<leftbound){
scrollspeed=(leftbound-curposy)/((menuwidth-restarea)/2) * maxspeed
if (window.lefttime) clearTimeout(lefttime)
if (movestate!="right") moveright()
}
else
scrollspeed=0
}

function contains_ns6(a, b) {
while (b.parentNode)
if ((b = b.parentNode) == a)
return true;
return false;
}

function stopmotion(e){
if ((window.event&&!crossmain.contains(event.toElement)) || (e && e.currentTarget && e.currentTarget!= e.relatedTarget && !contains_ns6(e.currentTarget, e.relatedTarget))){
if (window.lefttime) clearTimeout(lefttime)
if (window.righttime) clearTimeout(righttime)
movestate=""
}
}

function fillup(){
if (iedom){
crossmain=document.getElementById? document.getElementById("motioncontainer") : document.all.motioncontainer
menuwidth=parseInt(crossmain.style.width)
mainobjoffset=getposOffset(crossmain, "left")
cross_scroll=document.getElementById? document.getElementById("motiongallery") : document.all.motiongallery
document.getElementById("temp").innerHTML=cross_scroll.innerHTML //NEW stuff
actualwidth=document.all? cross_scroll.offsetWidth : document.getElementById("temp").offsetWidth
if (!window.opera) document.getElementById("temp").style.display="none"

crossmain.onmousemove=function(e){
motionengine(e)
}

crossmain.onmouseout=function(e){
stopmotion(e)
showhidediv("hidden")
}
}
loadedyes=1
if (endofgallerymsg!=""){
creatediv()
positiondiv()
}
}
window.onload=fillup

/*new gallery shadab*/



/*end*/









